@@ -43,6 +43,7 @@ def testTranscodeWave24b48k5_1():
43
43
assert_equals ( 48000 , dst_audioStream .getSampleRate () )
44
44
assert_equals ( 6 , dst_audioStream .getNbChannels () )
45
45
46
+
46
47
def testTranscodeWave24b48kstereo ():
47
48
"""
48
49
Transcode one audio stream (profile wave24b48kstereo).
@@ -76,6 +77,7 @@ def testTranscodeWave24b48kstereo():
76
77
assert_equals ( 48000 , dst_audioStream .getSampleRate () )
77
78
assert_equals ( 2 , dst_audioStream .getNbChannels () )
78
79
80
+
79
81
def testTranscodeWave24b48kmono ():
80
82
"""
81
83
Transcode one audio stream (profile wave24b48kmono).
@@ -109,6 +111,7 @@ def testTranscodeWave24b48kmono():
109
111
assert_equals ( 48000 , dst_audioStream .getSampleRate () )
110
112
assert_equals ( 1 , dst_audioStream .getNbChannels () )
111
113
114
+
112
115
def testTranscodeWave16b48kmono ():
113
116
"""
114
117
Transcode one audio stream (profile wave16b48kmono).
@@ -141,3 +144,40 @@ def testTranscodeWave16b48kmono():
141
144
assert_equals ( "signed 16 bits" , dst_audioStream .getSampleFormatLongName () )
142
145
assert_equals ( 48000 , dst_audioStream .getSampleRate () )
143
146
assert_equals ( 1 , dst_audioStream .getNbChannels () )
147
+
148
+
149
+ def testTranscodeWave16b48kmonoWithSilence ():
150
+ """
151
+ Transcode one audio stream (profile wave16b48kmono).
152
+ Complete with silence.
153
+ """
154
+ inputFileName = os .environ ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE' ]
155
+ outputFileName = "testTranscodeWave16b48kmonoWithSilence.wav"
156
+ outputDuration = 50
157
+
158
+ ouputFile = av .OutputFile ( outputFileName )
159
+ transcoder = av .Transcoder ( ouputFile )
160
+ transcoder .setProcessMethod ( av .eProcessMethodBasedOnDuration , 0 , outputDuration )
161
+
162
+ inputFile = av .InputFile ( inputFileName )
163
+ src_audioStream = inputFile .getProperties ().getAudioProperties ()[0 ]
164
+ audioStreamIndex = src_audioStream .getStreamIndex ()
165
+ transcoder .add ( inputFileName , audioStreamIndex , "wave16b48kmono" )
166
+
167
+ progress = av .ConsoleProgress ()
168
+ processStat = transcoder .process ( progress )
169
+
170
+ # check process stat returned
171
+ audioStat = processStat .getAudioStat (0 )
172
+ assert_almost_equals ( audioStat .getDuration (), outputDuration , delta = 0.01 )
173
+
174
+ # get dst file of transcode
175
+ dst_inputFile = av .InputFile ( outputFileName )
176
+ dst_properties = dst_inputFile .getProperties ()
177
+ dst_audioStream = dst_properties .getAudioProperties ()[0 ]
178
+
179
+ assert_equals ( "pcm_s16le" , dst_audioStream .getCodecName () )
180
+ assert_equals ( "s16" , dst_audioStream .getSampleFormatName () )
181
+ assert_equals ( "signed 16 bits" , dst_audioStream .getSampleFormatLongName () )
182
+ assert_equals ( 48000 , dst_audioStream .getSampleRate () )
183
+ assert_equals ( 1 , dst_audioStream .getNbChannels () )
0 commit comments