diff --git a/app/avProcessor/avProcessor.cpp b/app/avProcessor/avProcessor.cpp index fe94420f..2236caa6 100644 --- a/app/avProcessor/avProcessor.cpp +++ b/app/avProcessor/avProcessor.cpp @@ -144,6 +144,7 @@ int main(int argc, char** argv) avtranscoder::OutputFile outputFile(argv[2]); avtranscoder::Transcoder transcoder(outputFile); + transcoder.setProcessMethod(avtranscoder::eProcessMethodBasedOnStream, 0); parseConfigFile(inputConfigFile, transcoder); diff --git a/src/AvTranscoder/common.hpp b/src/AvTranscoder/common.hpp index 9e8835ad..747c681d 100644 --- a/src/AvTranscoder/common.hpp +++ b/src/AvTranscoder/common.hpp @@ -3,7 +3,7 @@ #define AVTRANSCODER_VERSION_MAJOR 0 #define AVTRANSCODER_VERSION_MINOR 8 -#define AVTRANSCODER_VERSION_MICRO 0 +#define AVTRANSCODER_VERSION_MICRO 1 #include diff --git a/src/AvTranscoder/decoder/AudioDecoder.cpp b/src/AvTranscoder/decoder/AudioDecoder.cpp index dae1684d..fa7da88a 100644 --- a/src/AvTranscoder/decoder/AudioDecoder.cpp +++ b/src/AvTranscoder/decoder/AudioDecoder.cpp @@ -116,12 +116,6 @@ bool AudioDecoder::decodeNextFrame(Frame& frameBuffer, const size_t channelIndex { AudioFrame& audioBuffer = static_cast(frameBuffer); - // if no need to extract one channel in the audio stream - if(audioBuffer.getNbChannels() == 1 && channelIndex == 0) - { - return decodeNextFrame(frameBuffer); - } - // decode all data of the next frame AudioFrame allDataOfNextFrame(audioBuffer); if(!decodeNextFrame(allDataOfNextFrame)) diff --git a/test/pyTest/testTranscoderTranscodeAudioMov.py b/test/pyTest/testTranscoderTranscodeAudioMov.py index 993f725f..be578819 100644 --- a/test/pyTest/testTranscoderTranscodeAudioMov.py +++ b/test/pyTest/testTranscoderTranscodeAudioMov.py @@ -43,9 +43,39 @@ def testTranscodeMovVariableNbSamplesPerFrame(): # get dst file of transcode dst_inputFile = av.InputFile( outputFileName ) - dst_inputFile.analyse( progress, av.eAnalyseLevelHeader ) dst_properties = dst_inputFile.getProperties() dst_audioStream = dst_properties.getAudioProperties()[0] assert_equals( "pcm_s24le", dst_audioStream.getCodecName() ) assert_equals( "PCM signed 24-bit little-endian", dst_audioStream.getCodecLongName() ) + + +def testTranscodeMovExtractChannels(): + """ + Transcode the audio stream of a MOV file which contains a video stream. + Extract channel one and third of the audio stream (5.1). + The encoding profile will be found from from input. + """ + inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_MOV_FILE'] + outputFileName = "testTranscodeMovExtractChannels.mov" + + ouputFile = av.OutputFile( outputFileName ) + transcoder = av.Transcoder( ouputFile ) + + inputFile = av.InputFile( inputFileName ) + src_audioStream = inputFile.getProperties().getAudioProperties()[0] + audioStreamIndex = src_audioStream.getStreamIndex() + transcoder.add( inputFileName, audioStreamIndex, 0 ) + transcoder.add( inputFileName, audioStreamIndex, 3 ) + + progress = av.ConsoleProgress() + processStat = transcoder.process( progress ) + + # check process stat returned + audioStat = processStat.getAudioStat(0) + assert_equals(src_audioStream.getDuration(), audioStat.getDuration()) + + # check dst audio streams + dst_inputFile = av.InputFile( outputFileName ) + for dst_audioStream in dst_inputFile.getProperties().getAudioProperties(): + assert_equals( 1, dst_audioStream.getNbChannels() )