@@ -292,3 +292,39 @@ def testMultipleOffsetFromSameInputFile():
292
292
assert_equals ( src_videoStream .getDuration () + offset_1 , dst_videoStream .getDuration () )
293
293
assert_equals ( src_audioStream .getDuration () + offset_1 , dst_audioStream .getDuration () )
294
294
295
+
296
+ def testMultipleOffsetFromSameStream ():
297
+ """
298
+ Process same stream several times with different offset at the beginning of the process.
299
+ """
300
+ inputFileName = os .environ ['AVTRANSCODER_TEST_AUDIO_MOV_FILE' ]
301
+ outputFileName = "testMultipleOffsetFromSameStream.mov"
302
+ offset_1 = 2
303
+ offset_2 = - 2
304
+
305
+ ouputFile = av .OutputFile ( outputFileName )
306
+ transcoder = av .Transcoder ( ouputFile )
307
+
308
+ transcoder .add ( inputFileName , 0 , "" , offset_1 )
309
+ transcoder .add ( inputFileName , 0 , "" , offset_2 )
310
+
311
+ progress = av .ConsoleProgress ()
312
+ transcoder .process ( progress )
313
+
314
+ # get src file
315
+ src_inputFile = av .InputFile ( inputFileName )
316
+ src_properties = src_inputFile .getProperties ()
317
+ src_videoStream = src_properties .getVideoProperties ()[0 ]
318
+
319
+ # get dst file
320
+ dst_inputFile = av .InputFile ( outputFileName )
321
+ dst_properties = dst_inputFile .getProperties ()
322
+ dst_videoStream_1 = dst_properties .getVideoProperties ()[0 ]
323
+ dst_videoStream_2 = dst_properties .getVideoProperties ()[1 ]
324
+
325
+ # check output duration
326
+ assert_equals ( src_videoStream .getDuration () + offset_1 , dst_videoStream_1 .getDuration () )
327
+ assert_equals ( src_videoStream .getDuration () + offset_1 , dst_videoStream_2 .getDuration () )
328
+ assert_almost_equals ( src_videoStream .getNbFrames () + ( offset_1 * dst_videoStream_1 .getFps () ), dst_videoStream_1 .getNbFrames (), delta = 0.01 )
329
+ assert_almost_equals ( src_videoStream .getNbFrames () + ( offset_1 * dst_videoStream_2 .getFps () ), dst_videoStream_2 .getNbFrames (), delta = 0.01 )
330
+
0 commit comments