Skip to content

Commit b022bfb

Browse files
author
Clement Champetier
committed
pyTest: added a test to check audio demux to one output
1 parent 7756c2c commit b022bfb

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/pyTest/testTranscoderTranscodeAudioMov.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def testTranscodeMovVariableNbSamplesPerFrame():
5252
def testTranscodeMovExtractChannels():
5353
"""
5454
Transcode the audio stream of a MOV file which contains a video stream.
55-
Extract channel one and third of the audio stream (5.1).
55+
Extract channel one and third of the audio stream (5.1), and create two output streams.
5656
The encoding profile will be found from from input.
5757
"""
5858
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']
@@ -78,3 +78,35 @@ def testTranscodeMovExtractChannels():
7878
dst_inputFile = av.InputFile( outputFileName )
7979
for dst_audioStream in dst_inputFile.getProperties().getAudioProperties():
8080
assert_equals( 1, dst_audioStream.getNbChannels() )
81+
82+
83+
def testTranscodeMovExtractChannelsToOneOutput():
84+
"""
85+
Transcode the audio stream of a MOV file which contains a video stream.
86+
Extract channel one, third and fifth of the audio stream (5.1), and create one output streams.
87+
The encoding profile will be found from from input.
88+
"""
89+
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']
90+
outputFileName = "testTranscodeMovExtractChannelsToOneOutput.mov"
91+
92+
ouputFile = av.OutputFile( outputFileName )
93+
transcoder = av.Transcoder( ouputFile )
94+
95+
inputFile = av.InputFile( inputFileName )
96+
src_audioStream = inputFile.getProperties().getAudioProperties()[0]
97+
audioStreamIndex = src_audioStream.getStreamIndex()
98+
audiochannelIndexArray = (0, 3, 5)
99+
transcoder.addStream( av.InputStreamDesc(inputFileName, audioStreamIndex, audiochannelIndexArray) )
100+
101+
progress = av.ConsoleProgress()
102+
processStat = transcoder.process( progress )
103+
104+
# check process stat returned
105+
audioStat = processStat.getAudioStat(0)
106+
assert_equals(src_audioStream.getDuration(), audioStat.getDuration())
107+
108+
# check dst audio streams
109+
dst_inputFile = av.InputFile( outputFileName )
110+
dst_audioProperties = dst_inputFile.getProperties().getAudioProperties()
111+
assert_equals( 1, len(dst_audioProperties) )
112+
assert_equals( 3, dst_audioProperties[0].getNbChannels() )

0 commit comments

Comments
 (0)