From d4f2d8f9e5d69f28caeb44bacab1de042a34b3a8 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 19 Oct 2015 14:05:03 +0200 Subject: [PATCH 1/5] OutputFile: copy channel_layout for each audio stream added --- src/AvTranscoder/file/OutputFile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AvTranscoder/file/OutputFile.cpp b/src/AvTranscoder/file/OutputFile.cpp index 346efe2c..075889ab 100644 --- a/src/AvTranscoder/file/OutputFile.cpp +++ b/src/AvTranscoder/file/OutputFile.cpp @@ -73,6 +73,7 @@ IOutputStream& OutputFile::addAudioStream( const AudioCodec& audioDesc ) stream.codec->sample_rate = audioDesc.getAVCodecContext().sample_rate; stream.codec->channels = audioDesc.getAVCodecContext().channels; + stream.codec->channel_layout = audioDesc.getAVCodecContext().channel_layout; stream.codec->sample_fmt = audioDesc.getAVCodecContext().sample_fmt; stream.codec->frame_size = audioDesc.getAVCodecContext().frame_size; From 2d06c07fff2daf77e312eb9cf56d5ae06f48466a Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 19 Oct 2015 14:08:46 +0200 Subject: [PATCH 2/5] pyTest: check channel_layout when rewrap an audio stream --- test/pyTest/testTranscoderRewrap.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/pyTest/testTranscoderRewrap.py b/test/pyTest/testTranscoderRewrap.py index 61c02c5b..0d4b9dcd 100644 --- a/test/pyTest/testTranscoderRewrap.py +++ b/test/pyTest/testTranscoderRewrap.py @@ -52,9 +52,6 @@ def testRewrapAudioStream(): src_propertiesMap = src_audioStream.getPropertiesAsMap() dst_propertiesMap = dst_audioStream.getPropertiesAsMap() for key in src_propertiesMap: - # @todo: don't skip channel layout - if key == "channelLayout": - continue assert_equals( src_propertiesMap[key], dst_propertiesMap[key] ) def testRewrapVideoStream(): From e947d9e850bdcf6cf832d093076b72fc807e49ab Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 19 Oct 2015 14:21:56 +0200 Subject: [PATCH 3/5] pyTest: check video bitrate when transcode to dnxhd --- test/pyTest/testTranscoderTranscodeVideo.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/pyTest/testTranscoderTranscodeVideo.py b/test/pyTest/testTranscoderTranscodeVideo.py index 3538fe9a..5e38d7c8 100644 --- a/test/pyTest/testTranscoderTranscodeVideo.py +++ b/test/pyTest/testTranscoderTranscodeVideo.py @@ -36,7 +36,9 @@ def testTranscodeDnxhd120(): assert_equals( "dnxhd", dst_videoStream.getCodecName() ) assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() ) - # assert_equals( 120000000, dst_videoStream.getBitRate() ) # 120000000 != 0L + expectedBitRate = 120000000 + deltaBitRate = expectedBitRate * 0.05 + assert_almost_equals( expectedBitRate, dst_videoStream.getBitRate(), delta=deltaBitRate ) assert_equals( "yuv422p", dst_videoStream.getPixelProperties().getPixelName() ) # assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L @@ -63,7 +65,9 @@ def testTranscodeDnxhd185(): assert_equals( "dnxhd", dst_videoStream.getCodecName() ) assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() ) - # assert_equals( 185000000, dst_videoStream.getBitRate() ) # 185000000 != 0L + expectedBitRate = 185000000 + deltaBitRate = expectedBitRate * 0.05 + assert_almost_equals( expectedBitRate, dst_videoStream.getBitRate(), delta=deltaBitRate ) assert_equals( "yuv422p", dst_videoStream.getPixelProperties().getPixelName() ) # assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L @@ -90,7 +94,9 @@ def testTranscodeDnxhd185x(): assert_equals( "dnxhd", dst_videoStream.getCodecName() ) assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() ) - # assert_equals( 185000000, dst_videoStream.getBitRate() ) # 185000000 != 0L + expectedBitRate = 185000000 + deltaBitRate = expectedBitRate * 0.05 + assert_almost_equals( expectedBitRate, dst_videoStream.getBitRate(), delta=deltaBitRate ) assert_equals( "yuv422p10le", dst_videoStream.getPixelProperties().getPixelName() ) # assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L @@ -125,4 +131,3 @@ def testTranscodeYUV420(): assert_equals( "mpeg2video", dst_videoStream.getCodecName() ) assert_equals( "yuv420p", dst_videoStream.getPixelProperties().getPixelName() ) - From 15c22fd374f58c316dc4ae0338f1829e50ce7c77 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 19 Oct 2015 14:26:57 +0200 Subject: [PATCH 4/5] pyTest: check bitrate with a relative delta when rewrap --- test/pyTest/testTranscoderRewrap.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pyTest/testTranscoderRewrap.py b/test/pyTest/testTranscoderRewrap.py index 0d4b9dcd..b36539f0 100644 --- a/test/pyTest/testTranscoderRewrap.py +++ b/test/pyTest/testTranscoderRewrap.py @@ -30,7 +30,7 @@ def testRewrapAudioStream(): ouputFile = av.OutputFile( outputFileName ) transcoder = av.Transcoder( ouputFile ) - transcoder.add( inputFileName, 0, "" ) + transcoder.add( inputFileName, 0 ) transcoder.process( progress ) # get dst file of wrap @@ -44,7 +44,7 @@ def testRewrapAudioStream(): assert_equals( src_properties.getFormatLongName(), dst_properties.getFormatLongName() ) assert_equals( src_properties.getStartTime(), dst_properties.getStartTime() ) assert_equals( src_properties.getDuration(), dst_properties.getDuration() ) - deltaBitRateAudio = 10 + deltaBitRateAudio = dst_properties.getBitRate() * 0.01 assert_almost_equals( src_properties.getBitRate(), dst_properties.getBitRate(), delta=deltaBitRateAudio ) assert_equals( src_properties.getPacketSize(), dst_properties.getPacketSize() ) @@ -71,7 +71,7 @@ def testRewrapVideoStream(): ouputFile = av.OutputFile( outputFileName ) transcoder = av.Transcoder( ouputFile ) - transcoder.add( inputFileName, 0, "" ) + transcoder.add( inputFileName, 0 ) transcoder.process( progress ) # get dst file of wrap @@ -85,7 +85,7 @@ def testRewrapVideoStream(): assert_equals( src_properties.getFormatLongName(), dst_properties.getFormatLongName() ) assert_equals( src_properties.getStartTime(), dst_properties.getStartTime() ) assert_equals( src_properties.getDuration(), dst_properties.getDuration() ) - deltaBitRateVideo = 500000 + deltaBitRateVideo = dst_properties.getBitRate() * 0.15 assert_almost_equals( src_properties.getBitRate(), dst_properties.getBitRate(), delta=deltaBitRateVideo ) assert_equals( src_properties.getPacketSize(), dst_properties.getPacketSize() ) From e71368c401a176f7d5a3ac5e67ebe37bd6832392 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 19 Oct 2015 14:28:04 +0200 Subject: [PATCH 5/5] pyTest: do not check channel_layout when transcode audio Because the channel layout is not specified in the audio profile. --- test/pyTest/testTranscoderTranscodeAudioWave.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/pyTest/testTranscoderTranscodeAudioWave.py b/test/pyTest/testTranscoderTranscodeAudioWave.py index b10ad1fe..82ab2eea 100644 --- a/test/pyTest/testTranscoderTranscodeAudioWave.py +++ b/test/pyTest/testTranscoderTranscodeAudioWave.py @@ -39,7 +39,6 @@ def testTranscodeWave24b48k5_1(): assert_equals( "s32", dst_audioStream.getSampleFormatName() ) assert_equals( "signed 32 bits", dst_audioStream.getSampleFormatLongName() ) assert_equals( 48000, dst_audioStream.getSampleRate() ) - # assert_equals( "1 channels", dst_audioStream.getChannelLayout() ) # '1 channels' != '0 channels' assert_equals( 6, dst_audioStream.getChannels() ) def testTranscodeWave24b48kstereo(): @@ -68,7 +67,6 @@ def testTranscodeWave24b48kstereo(): assert_equals( "s32", dst_audioStream.getSampleFormatName() ) assert_equals( "signed 32 bits", dst_audioStream.getSampleFormatLongName() ) assert_equals( 48000, dst_audioStream.getSampleRate() ) - # assert_equals( "1 channels", dst_audioStream.getChannelLayout() ) # '1 channels' != '0 channels' assert_equals( 2, dst_audioStream.getChannels() ) def testTranscodeWave24b48kmono(): @@ -97,7 +95,6 @@ def testTranscodeWave24b48kmono(): assert_equals( "s32", dst_audioStream.getSampleFormatName() ) assert_equals( "signed 32 bits", dst_audioStream.getSampleFormatLongName() ) assert_equals( 48000, dst_audioStream.getSampleRate() ) - # assert_equals( "1 channels", dst_audioStream.getChannelLayout() ) # '1 channels' != '0 channels' assert_equals( 1, dst_audioStream.getChannels() ) def testTranscodeWave16b48kmono(): @@ -126,5 +123,4 @@ def testTranscodeWave16b48kmono(): assert_equals( "s16", dst_audioStream.getSampleFormatName() ) assert_equals( "signed 16 bits", dst_audioStream.getSampleFormatLongName() ) assert_equals( 48000, dst_audioStream.getSampleRate() ) - # assert_equals( "1 channels", dst_audioStream.getChannelLayout() ) # '1 channels' != '0 channels' assert_equals( 1, dst_audioStream.getChannels() )