[FFmpeg-user] Preserving preserved loudness when downmixing audio from 5.1 AC3 to stereo AAC
Francois Visagie
francois.visagie at gmail.com
Fri Aug 2 16:09:19 CEST 2013
Hi All,
What is the simplest way of preserving perceived loudness when rematrixing
audio from 5.1 AC3 to stereo AAC? There seem to be many different options
available, not all are fully documented, and results vary:
. output from '-ac 2' is noticeably softer than the original
. '-filter:a aformat=channel_layouts=stereo' seems to have the same
volume as the original
. '-filter:a_aresample=ocl=3' is noticeably softer than the original
I'd have expected the resampler's rematrixing to do the best job, but given
the above results, is it OK going with '-filter:a
aformat=channel_layouts=stereo'? Or is some other way recommended?
Console output:
C:\Users\fvisagie\Videos\Home Videos\Testing\x264\AC3>ffmpeg -i inac3.mpg
-ac 2 test-ac2.mp4
ffmpeg version N-54277-gff130d7 Copyright (c) 2000-2013 the FFmpeg
developers
built on Jun 30 2013 01:20:12 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from 'inac3.mpg':
Duration: 00:00:08.99, start: 0.184656, bitrate: 7204 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
[libx264 @ 027a79e0] using SAR=64/45
[libx264 @ 027a79e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 027a79e0] profile High, level 3.0
[libx264 @ 027a79e0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3
b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test-ac2.mp4':
Metadata:
encoder : Lavf55.10.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
720x576 [SAR 64:45 DAR 16:9], q=-1--1, 12800 tbn, 25 tbc
Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000
Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame= 222 fps= 42 q=-1.0 Lsize= 2370kB time=00:00:09.03
bitrate=2149.2kbits/s
video:2220kB audio:142kB subtitle:0 global headers:0kB muxing overhead
0.327047%
[libx264 @ 027a79e0] frame I:3 Avg QP:19.91 size: 26627
[libx264 @ 027a79e0] frame P:136 Avg QP:24.64 size: 14045
[libx264 @ 027a79e0] frame B:83 Avg QP:29.17 size: 3406
[libx264 @ 027a79e0] consecutive B-frames: 26.6% 70.3% 1.4% 1.8%
[libx264 @ 027a79e0] mb I I16..4: 10.9% 84.9% 4.2%
[libx264 @ 027a79e0] mb P I16..4: 4.7% 3.9% 0.6% P16..4: 37.8% 26.6%
15.8% 0.0% 0.0% skip:10.5%
[libx264 @ 027a79e0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 43.4% 7.8%
1.8% direct: 2.4% skip:44.4% L0:26.8% L1:47.8% BI:25.4%
[libx264 @ 027a79e0] 8x8 transform intra:50.8% inter:69.2%
[libx264 @ 027a79e0] coded y,uvDC,uvAC intra: 38.9% 51.9% 29.5% inter: 31.3%
38.6% 9.0%
[libx264 @ 027a79e0] i16 v,h,dc,p: 80% 11% 5% 4%
[libx264 @ 027a79e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 10% 25% 4% 7% 9%
5% 8% 6%
[libx264 @ 027a79e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 16% 6% 11% 13%
7% 9% 4%
[libx264 @ 027a79e0] i8c dc,h,v,p: 67% 12% 16% 5%
[libx264 @ 027a79e0] Weighted P-Frames: Y:5.9% UV:2.9%
[libx264 @ 027a79e0] ref P L0: 72.1% 24.1% 3.0% 0.8% 0.0%
[libx264 @ 027a79e0] ref B L0: 98.5% 1.5%
[libx264 @ 027a79e0] ref B L1: 100.0% 0.0%
[libx264 @ 027a79e0] kb/s:2047.52
C:\Users\fvisagie\Videos\Home Videos\Testing\x264\AC3>ffmpeg -i inac3.mpg
-filter:a aformat=channel_layouts=stereo
test-filter.a_aformat=channel_layouts=stereo.
mp4
ffmpeg version N-54277-gff130d7 Copyright (c) 2000-2013 the FFmpeg
developers
built on Jun 30 2013 01:20:12 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from 'inac3.mpg':
Duration: 00:00:08.99, start: 0.184656, bitrate: 7204 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
[libx264 @ 035be3a0] using SAR=64/45
[libx264 @ 035be3a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 035be3a0] profile High, level 3.0
[libx264 @ 035be3a0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3
b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test-filter.a_aformat=channel_layouts=stereo.mp4':
Metadata:
encoder : Lavf55.10.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
720x576 [SAR 64:45 DAR 16:9], q=-1--1, 12800 tbn, 25 tbc
Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000
Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame= 222 fps= 42 q=-1.0 Lsize= 2370kB time=00:00:09.03
bitrate=2149.2kbits/s
video:2220kB audio:142kB subtitle:0 global headers:0kB muxing overhead
0.327056%
[libx264 @ 035be3a0] frame I:3 Avg QP:19.91 size: 26627
[libx264 @ 035be3a0] frame P:136 Avg QP:24.64 size: 14045
[libx264 @ 035be3a0] frame B:83 Avg QP:29.17 size: 3406
[libx264 @ 035be3a0] consecutive B-frames: 26.6% 70.3% 1.4% 1.8%
[libx264 @ 035be3a0] mb I I16..4: 10.9% 84.9% 4.2%
[libx264 @ 035be3a0] mb P I16..4: 4.7% 3.9% 0.6% P16..4: 37.8% 26.6%
15.8% 0.0% 0.0% skip:10.5%
[libx264 @ 035be3a0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 43.4% 7.8%
1.8% direct: 2.4% skip:44.4% L0:26.8% L1:47.8% BI:25.4%
[libx264 @ 035be3a0] 8x8 transform intra:50.8% inter:69.2%
[libx264 @ 035be3a0] coded y,uvDC,uvAC intra: 38.9% 51.9% 29.5% inter: 31.3%
38.6% 9.0%
[libx264 @ 035be3a0] i16 v,h,dc,p: 80% 11% 5% 4%
[libx264 @ 035be3a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 10% 25% 4% 7% 9%
5% 8% 6%
[libx264 @ 035be3a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 16% 6% 11% 13%
7% 9% 4%
[libx264 @ 035be3a0] i8c dc,h,v,p: 67% 12% 16% 5%
[libx264 @ 035be3a0] Weighted P-Frames: Y:5.9% UV:2.9%
[libx264 @ 035be3a0] ref P L0: 72.1% 24.1% 3.0% 0.8% 0.0%
[libx264 @ 035be3a0] ref B L0: 98.5% 1.5%
[libx264 @ 035be3a0] ref B L1: 100.0% 0.0%
[libx264 @ 035be3a0] kb/s:2047.52
C:\Users\fvisagie\Videos\Home Videos\Testing\x264\AC3>ffmpeg -i inac3.mpg
-filter:a aresample=ocl=3 test-filter.a_aresample=ocl=3.mp4
ffmpeg version N-54277-gff130d7 Copyright (c) 2000-2013 the FFmpeg
developers
built on Jun 30 2013 01:20:12 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from 'inac3.mpg':
Duration: 00:00:08.99, start: 0.184656, bitrate: 7204 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
[libx264 @ 0032b2c0] using SAR=64/45
[libx264 @ 0032b2c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0032b2c0] profile High, level 3.0
[libx264 @ 0032b2c0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3
b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test-filter.a_aresample=ocl=3.mp4':
Metadata:
encoder : Lavf55.10.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
720x576 [SAR 64:45 DAR 16:9], q=-1--1, 12800 tbn, 25 tbc
Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000
Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame= 222 fps= 42 q=-1.0 Lsize= 2370kB time=00:00:09.03
bitrate=2149.2kbits/s
video:2220kB audio:142kB subtitle:0 global headers:0kB muxing overhead
0.327047%
[libx264 @ 0032b2c0] frame I:3 Avg QP:19.91 size: 26627
[libx264 @ 0032b2c0] frame P:136 Avg QP:24.64 size: 14045
[libx264 @ 0032b2c0] frame B:83 Avg QP:29.17 size: 3406
[libx264 @ 0032b2c0] consecutive B-frames: 26.6% 70.3% 1.4% 1.8%
[libx264 @ 0032b2c0] mb I I16..4: 10.9% 84.9% 4.2%
[libx264 @ 0032b2c0] mb P I16..4: 4.7% 3.9% 0.6% P16..4: 37.8% 26.6%
15.8% 0.0% 0.0% skip:10.5%
[libx264 @ 0032b2c0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 43.4% 7.8%
1.8% direct: 2.4% skip:44.4% L0:26.8% L1:47.8% BI:25.4%
[libx264 @ 0032b2c0] 8x8 transform intra:50.8% inter:69.2%
[libx264 @ 0032b2c0] coded y,uvDC,uvAC intra: 38.9% 51.9% 29.5% inter: 31.3%
38.6% 9.0%
[libx264 @ 0032b2c0] i16 v,h,dc,p: 80% 11% 5% 4%
[libx264 @ 0032b2c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 10% 25% 4% 7% 9%
5% 8% 6%
[libx264 @ 0032b2c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 16% 6% 11% 13%
7% 9% 4%
[libx264 @ 0032b2c0] i8c dc,h,v,p: 67% 12% 16% 5%
[libx264 @ 0032b2c0] Weighted P-Frames: Y:5.9% UV:2.9%
[libx264 @ 0032b2c0] ref P L0: 72.1% 24.1% 3.0% 0.8% 0.0%
[libx264 @ 0032b2c0] ref B L0: 98.5% 1.5%
[libx264 @ 0032b2c0] ref B L1: 100.0% 0.0%
[libx264 @ 0032b2c0] kb/s:2047.52
Thanks,
Francois
Francois Visagie
T: +27 (83) 326-4358
F: +27 (86) 511-3490
E: francois.visagie at gmail.com
More information about the ffmpeg-user
mailing list