Skip to content

Commit a983b2c

Browse files
author
Clement Champetier
committed
pyTest: added a test to check the extraction of channels
1 parent 72b7f4d commit a983b2c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/pyTest/testTranscoderTranscodeAudioMov.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,39 @@ def testTranscodeMovVariableNbSamplesPerFrame():
4343

4444
# get dst file of transcode
4545
dst_inputFile = av.InputFile( outputFileName )
46-
dst_inputFile.analyse( progress, av.eAnalyseLevelHeader )
4746
dst_properties = dst_inputFile.getProperties()
4847
dst_audioStream = dst_properties.getAudioProperties()[0]
4948

5049
assert_equals( "pcm_s24le", dst_audioStream.getCodecName() )
5150
assert_equals( "PCM signed 24-bit little-endian", dst_audioStream.getCodecLongName() )
51+
52+
53+
def testTranscodeMovExtractChannels():
54+
"""
55+
Transcode the audio stream of a MOV file which contains a video stream.
56+
Extract channel one and third of the audio stream (5.1).
57+
The encoding profile will be found from from input.
58+
"""
59+
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE']
60+
outputFileName = "testTranscodeMovExtractChannels.mov"
61+
62+
ouputFile = av.OutputFile( outputFileName )
63+
transcoder = av.Transcoder( ouputFile )
64+
65+
inputFile = av.InputFile( inputFileName )
66+
src_audioStream = inputFile.getProperties().getAudioProperties()[0]
67+
audioStreamIndex = src_audioStream.getStreamIndex()
68+
transcoder.add( inputFileName, audioStreamIndex, 0 )
69+
transcoder.add( inputFileName, audioStreamIndex, 3 )
70+
71+
progress = av.ConsoleProgress()
72+
processStat = transcoder.process( progress )
73+
74+
# check process stat returned
75+
audioStat = processStat.getAudioStat(0)
76+
assert_equals(src_audioStream.getDuration(), audioStat.getDuration())
77+
78+
# check dst audio streams
79+
dst_inputFile = av.InputFile( outputFileName )
80+
for dst_audioStream in dst_inputFile.getProperties().getAudioProperties():
81+
assert_equals( 1, dst_audioStream.getNbChannels() )

0 commit comments

Comments
 (0)