@@ -51,3 +51,43 @@ def testAddAllStreamsOfFileWhichDoesNotExist():
51
51
52
52
# process
53
53
transcoder .process ()
54
+
55
+
56
+ def testAddSeveralInputsToCreateOneOutput ():
57
+ """
58
+ Add several audio inputs and create one output stream.
59
+ """
60
+ # inputs
61
+ inputs = av .InputStreamDescVector ()
62
+ inputFileName = os .environ ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE' ]
63
+ inputFile = av .InputFile (inputFileName )
64
+ src_audioStream = inputFile .getProperties ().getAudioProperties ()[0 ]
65
+ src_audioStreamIndex = src_audioStream .getStreamIndex ()
66
+ inputs .append (av .InputStreamDesc (inputFileName , src_audioStreamIndex , (0 ,1 )))
67
+ inputs .append (av .InputStreamDesc (inputFileName , src_audioStreamIndex , (2 ,3 )))
68
+ inputs .append (av .InputStreamDesc (inputFileName , src_audioStreamIndex , (4 ,5 )))
69
+
70
+ # output
71
+ outputFileName = "testAddSeveralInputsToCreateOneOutput.mov"
72
+ ouputFile = av .OutputFile (outputFileName )
73
+
74
+ transcoder = av .Transcoder (ouputFile )
75
+ transcoder .addStream (inputs , "wave24b48kstereo" )
76
+
77
+ # process
78
+ processStat = transcoder .process ()
79
+
80
+ # check process stat returned
81
+ audioStat = processStat .getAudioStat (0 )
82
+ assert_equals (src_audioStream .getDuration (), audioStat .getDuration ())
83
+
84
+ # get dst file of transcode
85
+ dst_inputFile = av .InputFile (outputFileName )
86
+ dst_properties = dst_inputFile .getProperties ()
87
+ dst_audioStream = dst_properties .getAudioProperties ()[0 ]
88
+
89
+ assert_equals ( "pcm_s24le" , dst_audioStream .getCodecName () )
90
+ assert_equals ( "s32" , dst_audioStream .getSampleFormatName () )
91
+ assert_equals ( "signed 32 bits" , dst_audioStream .getSampleFormatLongName () )
92
+ assert_equals ( 48000 , dst_audioStream .getSampleRate () )
93
+ assert_equals ( 2 , dst_audioStream .getNbChannels () )
0 commit comments