From 79576270d34542e9cef821b5329dc2916236f738 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 1 Feb 2016 15:27:44 +0100 Subject: [PATCH 1/4] avprocessor app: the process method is based on the first stream Instead of the longest (which is infinity in case of generated streams...). --- app/avProcessor/avProcessor.cpp | 1 + 1 file changed, 1 insertion(+) 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); From 72b7f4de33d6ff7939269b6921dcf3f68b1ef830 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 1 Feb 2016 15:31:25 +0100 Subject: [PATCH 2/4] AudioDecoder: removed check of nbChannel when extract one channel in an audio stream * Revert of commit e5f16f7ab23063fe9a8c647c490b37c97c23ee81 * The user has to check what he wants to decode (it will work, but it is more expensive to try to extract one channel than only decode the frame). --- src/AvTranscoder/decoder/AudioDecoder.cpp | 6 ------ 1 file changed, 6 deletions(-) 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)) From a983b2cac2583cbb90cf4b2962f5c686080c57cb Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 1 Feb 2016 15:34:03 +0100 Subject: [PATCH 3/4] pyTest: added a test to check the extraction of channels --- .../pyTest/testTranscoderTranscodeAudioMov.py | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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() ) From c7295bad2f91eabf76aa6404b80d540d3633ed34 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 1 Feb 2016 15:34:39 +0100 Subject: [PATCH 4/4] Add patch: up to v0.8.1 --- src/AvTranscoder/common.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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