[FFmpeg-user] ffplay does not seems to downmix 5.1ch audio to Stereo with "-ac 2"

Kimio Miyamura xanadu at apost.plala.or.jp
Wed Nov 19 13:28:01 CET 2014


Hello list members, 

I'm trying to playback a mp4 video which contains 5.1ch audio with ffplay.  The mp4 file was made from DVD stream dump with mplayer, like the following ffmpeg command.  

$ ffmpeg -i /Volumes/USB\ HD\ 1/stream.dump \
> -map 0:0 -c:v libx264 -preset slow -level 4.1 -profile:v High -crf 18 \
> -map 0:2 -c:a libfdk_aac -filter:a volume=4.0 \
> -ss 00:17:29.500 -t 00:01:49.500 \
> test.mp4
ffmpeg version N-67742-g3f07dd6 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 17 2014 09:27:26 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-filters --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libmp3lame --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab
  libavutil      54. 13.100 / 54. 13.100
  libavcodec     56. 12.101 / 56. 12.101
  libavformat    56. 13.100 / 56. 13.100
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from '/Volumes/USB HD 1/stream.dump':
  Duration: 01:53:51.81, start: 0.041500, bitrate: 8136 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9800 kb/s, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
[libx264 @ 0x7feffc022400] using SAR=32/27
[libx264 @ 0x7feffc022400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7feffc022400] profile High, level 4.1
[libx264 @ 0x7feffc022400] 264 - core 142 r2491 24e4fed - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf56.13.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.12.101 libx264
    Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, s16, 488 kb/s
    Metadata:
      encoder         : Lavc56.12.101 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:2 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[mpeg @ 0x7feffc016800] New subtitle stream 0:3 at pos:29865998 and DTS:34.6427s
[mpeg @ 0x7feffc016800] New subtitle stream 0:4 at pos:29868046 and DTS:34.6427s
[mpeg @ 0x7feffc016800] New subtitle stream 0:5 at pos:146962446 and DTS:152.661s
[mpeg @ 0x7feffc016800] New subtitle stream 0:6 at pos:146964494 and DTS:152.661s
frame=   69 fps=3.9 q=24.0 size=      80kB time=00:00:02.28 bitrate= 286.4kbits/frame=  115 fps=6.4 q=24.0 size=     585kB time=00:00:03.86 bitrate=1240.7kbits/frame=  157 fps=8.5 q=24.0 size=    1033kB time=00:00:05.16 bitrate=1639.6kbits/frame=  196 fps= 10 q=24.0 size=    1477kB time=00:00:06.48 bitrate=1866.1kbits/frame=  235 fps= 12 q=24.0 size=    1869kB time=00:00:07.85 bitrate=1950.1kbits/frame=  278 fps= 14 q=24.0 size=    2442kB time=00:00:09.25 bitrate=2160.7kbits/frame=  322 fps= 16 q=24.0 size=    2998kB time=00:00:10.70 bitrate=2293.3kbits/frame=  364 fps= 17 q=24.0 size=    3481kB time=00:00:12.11 bitrate=2353.3kbits/frame=  405 fps= 19 q=24.0 size=    3993kB time=00:00:13.46 bitrate=2430.1kbits/frame=  450 fps= 20 q=24.0 size=    4526kB time=00:00:14.95 bitrate=2479.3kbits/frame=  495 fps= 22 q=24.0 size=    5041kB time=00:00:16.46 bitrate=2507.3kbits/frame=  537 fps= 23 q=24.0 size=    5522kB time=00:00:17.89 bitrate=2527.2kbits/frame=  578 fps= 24 q=24.0 size=    5984kB time=00:00:19.24 bitrate=2547.4kbits/frame=  624 fps= 26 q=24.0 size=    6517kB time=00:00:20.82 bitrate=2564.2kbits/frame=  667 fps= 27 q=24.0 size=    6972kB time=00:00:22.16 bitrate=2576.8kbits/frame=  705 fps= 28 q=24.0 size=    7425kB time=00:00:23.46 bitrate=2591.9kbits/frame=  750 fps= 29 q=24.0 size=    7915kB time=00:00:24.91 bitrate=2602.3kbits/frame=  793 fps= 30 q=24.0 size=    8364kB time=00:00:26.38 bitrate=2596.3kbits/frame=  837 fps= 31 q=24.0 size=    8873kB time=00:00:27.92 bitrate=2602.9kbits/frame=  878 fps= 32 q=24.0 size=    9363kB time=00:00:29.26 bitrate=2620.7kbits/frame=  915 fps= 33 q=24.0 size=    9806kB time=00:00:30.48 bitrate=2635.1kbits/frame=  957 fps= 34 q=24.0 size=   10281kB time=00:00:31.91 bitrate=2639.1kbits/frame=  997 fps= 35 q=24.0 size=   10737kB time=00:00:33.17 bitrate=2651.5kbits/frame= 1035 fps= 35 q=24.0 size=   11220kB time=00:00:34.47 bitrate=2666.1kbits/frame= 1077 fps= 36 q=24.0 size=   11771kB time=00:00:35.92 bitrate=2684.0kbits/frame= 1118 fps= 37 q=24.0 size=   12250kB time=00:00:37.29 bitrate=2691.0kbits/frame= 1160 fps= 38 q=24.0 size=   12737kB time=00:00:38.67 bitrate=2697.8kbits/frame= 1200 fps= 38 q=24.0 size=   13195kB time=00:00:39.97 bitrate=2703.8kbits/frame= 1239 fps= 39 q=24.0 size=   13638kB time=00:00:41.32 bitrate=2703.8kbits/frame= 1279 fps= 39 q=24.0 size=   14123kB time=00:00:42.60 bitrate=2715.6kbits/frame= 1324 fps= 40 q=24.0 size=   14680kB time=00:00:44.11 bitrate=2725.9kbits/frame= 1372 fps= 41 q=24.0 size=   15223kB time=00:00:45.65 bitrate=2731.7kbits/frame= 1414 fps= 42 q=24.0 size=   15648kB time=00:00:47.12 bitrate=2720.1kbits/frame= 1460 fps= 42 q=24.0 size=   16087kB time=00:00:48.66 bitrate=2708.2kbits/frame= 1500 fps= 43 q=24.0 size=   16534kB time=00:00:50.00 bitrate=2708.6kbits/frame= 1543 fps= 43 q=24.0 size=   17021kB time=00:00:51.43 bitrate=2710.9kbits/frame= 1582 fps= 44 q=24.0 size=   17451kB time=00:00:52.71 bitrate=2711.9kbits/frame= 1627 fps= 45 q=24.0 size=   17963kB time=00:00:54.18 bitrate=2715.6kbits/frame= 1665 fps= 45 q=24.0 size=   18407kB time=00:00:55.50 bitrate=2716.5kbits/frame= 1707 fps= 45 q=24.0 size=   18842kB time=00:00:56.93 bitrate=2710.9kbits/frame= 1748 fps= 46 q=24.0 size=   19312kB time=00:00:58.32 bitrate=2712.4kbits/frame= 1790 fps= 46 q=24.0 size=   19738kB time=00:00:59.66 bitrate=2709.9kbits/frame= 1832 fps= 47 q=24.0 size=   20145kB time=00:01:01.03 bitrate=2703.9kbits/frame= 1875 fps= 47 q=24.0 size=   20668kB time=00:01:02.48 bitrate=2709.7kbits/frame= 1908 fps= 48 q=24.0 size=   21041kB time=00:01:03.63 bitrate=2708.5kbits/frame= 1947 fps= 48 q=24.0 size=   21468kB time=00:01:04.93 bitrate=2708.2kbits/frame= 1987 fps= 48 q=24.0 size=   21893kB time=00:01:06.15 bitrate=2711.1kbits/frame= 2022 fps= 49 q=24.0 size=   22283kB time=00:01:07.43 bitrate=2707.0kbits/frame= 2065 fps= 49 q=24.0 size=   22744kB time=00:01:08.94 bitrate=2702.3kbits/frame= 2100 fps= 49 q=24.0 size=   23191kB time=00:01:10.03 bitrate=2712.5kbits/frame= 2140 fps= 50 q=24.0 size=   23640kB time=00:01:11.40 bitrate=2712.2kbits/frame= 2182 fps= 50 q=24.0 size=   24017kB time=00:01:12.72 bitrate=2705.4kbits/frame= 2221 fps= 50 q=24.0 size=   24378kB time=00:01:14.09 bitrate=2695.4kbits/frame= 2262 fps= 51 q=24.0 size=   24747kB time=00:01:15.43 bitrate=2687.5kbits/frame= 2303 fps= 51 q=24.0 size=   25207kB time=00:01:16.82 bitrate=2688.0kbits/frame= 2342 fps= 51 q=24.0 size=   25635kB time=00:01:18.10 bitrate=2688.9kbits/frame= 2382 fps= 51 q=24.0 size=   26089kB time=00:01:19.46 bitrate=2689.4kbits/frame= 2420 fps= 52 q=24.0 size=   26585kB time=00:01:20.66 bitrate=2700.0kbits/frame= 2458 fps= 52 q=24.0 size=   27008kB time=00:01:21.94 bitrate=2700.1kbits/frame= 2494 fps= 52 q=24.0 size=   27449kB time=00:01:23.17 bitrate=2703.4kbits/frame= 2535 fps= 52 q=24.0 size=   27939kB time=00:01:24.52 bitrate=2707.9kbits/frame= 2574 fps= 53 q=24.0 size=   28348kB time=00:01:25.86 bitrate=2704.5kbits/frame= 2613 fps= 53 q=24.0 size=   28774kB time=00:01:27.14 bitrate=2704.8kbits/frame= 2649 fps= 53 q=24.0 size=   29189kB time=00:01:28.36 bitrate=2706.1kbits/frame= 2686 fps= 53 q=24.0 size=   29635kB time=00:01:29.55 bitrate=2710.8kbits/frame= 2725 fps= 53 q=24.0 size=   30074kB time=00:01:30.92 bitrate=2709.6kbits/frame= 2760 fps= 54 q=24.0 size=   30499kB time=00:01:32.05 bitrate=2714.2kbits/frame= 2798 fps= 54 q=24.0 size=   30972kB time=00:01:33.33 bitrate=2718.4kbits/frame= 2835 fps= 54 q=24.0 size=   31395kB time=00:01:34.57 bitrate=2719.6kbits/frame= 2877 fps= 54 q=24.0 size=   31862kB time=00:01:36.02 bitrate=2718.3kbits/frame= 2918 fps= 54 q=24.0 size=   32312kB time=00:01:37.30 bitrate=2720.5kbits/frame= 2955 fps= 55 q=24.0 size=   32748kB time=00:01:38.53 bitrate=2722.5kbits/frame= 2994 fps= 55 q=24.0 size=   33179kB time=00:01:39.86 bitrate=2721.8kbits/frame= 3027 fps= 55 q=24.0 size=   33582kB time=00:01:40.97 bitrate=2724.6kbits/frame= 3067 fps= 55 q=24.0 size=   34076kB time=00:01:42.22 bitrate=2730.6kbits/frame= 3105 fps= 55 q=24.0 size=   34526kB time=00:01:43.57 bitrate=2730.8kbits/frame= 3144 fps= 55 q=24.0 size=   34958kB time=00:01:44.93 bitrate=2729.0kbits/frame= 3188 fps= 56 q=21.0 size=   35367kB time=00:01:46.38 bitrate=2723.3kbits/frame= 3226 fps= 56 q=24.0 size=   35822kB time=00:01:47.56 bitrate=2728.2kbits/frame= 3262 fps= 56 q=24.0 size=   36225kB time=00:01:48.77 bitrate=2728.1kbits/frame= 3282 fps= 55 q=-1.0 Lsize=   37302kB time=00:01:49.50 bitrate=2790.5kbits/s dup=657 drop=0    
video:30647kB audio:6536kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.319933%
[libx264 @ 0x7feffc022400] frame I:26    Avg QP:16.36  size: 63960
[libx264 @ 0x7feffc022400] frame P:987   Avg QP:19.48  size: 19693
[libx264 @ 0x7feffc022400] frame B:2269  Avg QP:22.33  size:  4532
[libx264 @ 0x7feffc022400] consecutive B-frames:  5.2%  1.9% 17.6% 75.3%
[libx264 @ 0x7feffc022400] mb I  I16..4:  1.5% 93.0%  5.5%
[libx264 @ 0x7feffc022400] mb P  I16..4:  0.0%  6.3%  0.2%  P16..4: 36.0% 27.0% 17.1%  0.0%  0.0%    skip:13.5%
[libx264 @ 0x7feffc022400] mb B  I16..4:  0.0%  0.4%  0.0%  B16..8: 38.1%  7.0%  1.4%  direct: 6.6%  skip:46.4%  L0:37.9% L1:39.5% BI:22.7%
[libx264 @ 0x7feffc022400] 8x8 transform intra:95.5% inter:76.0%
[libx264 @ 0x7feffc022400] direct mvs  spatial:99.7% temporal:0.3%
[libx264 @ 0x7feffc022400] coded y,uvDC,uvAC intra: 98.3% 97.7% 90.1% inter: 33.9% 43.8% 11.2%
[libx264 @ 0x7feffc022400] i16 v,h,dc,p: 49% 11% 11% 29%
[libx264 @ 0x7feffc022400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 11% 12%  8% 10% 12% 10% 11% 11%
[libx264 @ 0x7feffc022400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  8%  2%  9% 17% 17% 14% 13% 10%
[libx264 @ 0x7feffc022400] i8c dc,h,v,p: 52% 15% 16% 17%
[libx264 @ 0x7feffc022400] Weighted P-Frames: Y:3.9% UV:0.9%
[libx264 @ 0x7feffc022400] ref P L0: 38.7% 14.0% 27.6%  9.0%  8.3%  2.3%  0.1%
[libx264 @ 0x7feffc022400] ref B L0: 59.3% 30.2%  7.2%  3.2%
[libx264 @ 0x7feffc022400] ref B L1: 90.6%  9.4%
[libx264 @ 0x7feffc022400] kb/s:2292.56


To playback full audio of test.mp4 with ffplay, I need to use pan filter.

$ ffplay -i test.mp4 -af "pan=stereo|FL<FL+FC+BL+SL|FR<FR+FC+BR+SR"
ffplay version N-67742-g3f07dd6 Copyright (c) 2003-2014 the FFmpeg developers
  built on Nov 17 2014 09:27:26 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-filters --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libmp3lame --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab
  libavutil      54. 13.100 / 54. 13.100
  libavcodec     56. 12.101 / 56. 12.101
  libavformat    56. 13.100 / 56. 13.100
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':q=    0B f=0/0   
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.13.100
  Duration: 00:01:49.54, start: 0.042667, bitrate: 2789 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 2292 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 488 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
  23.10 A-V: -0.017 fd=  75 aq=   17KB vq=   53KB sq=    0B f=0/0


If I use "-ac 2" with ffplay like the following, seems to right side channel sound have lost.

$ ffplay -i test.mp4 -ac 2
ffplay version N-67742-g3f07dd6 Copyright (c) 2003-2014 the FFmpeg developers
  built on Nov 17 2014 09:27:26 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-filters --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libmp3lame --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab
  libavutil      54. 13.100 / 54. 13.100
  libavcodec     56. 12.101 / 56. 12.101
  libavformat    56. 13.100 / 56. 13.100
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':q=    0B f=0/0   
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.13.100
  Duration: 00:01:49.54, start: 0.042667, bitrate: 2789 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 2292 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 488 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
  16.47 A-V:  0.000 fd=  53 aq=   16KB vq=   54KB sq=    0B f=0/0


If I use "-ac 2" with ffmpeg, that means downmix audio at the timing of encoding, ffplay playback full audio correctly.  


I don't know why this strange phenomenon occurs.  Can anyone help to solve the question?

 
// Miya


More information about the ffmpeg-user mailing list