No Audio on Windows Media PLayer When Converting Uncompressed Video to MP4 with AAC using ffmpeg-Collection of common programming errors


  • Dominic P

    I’m having problems converting uncompressed video to mp4 format using AAC for the audio. I don’t get any errors, but no audio plays with the video in the output files in Windows Media PLayer (other players handle it fine, but normally WMP doesn’t have an issue with my other MP4’s so I still feel like something’s wrong here). Here is my full command:

    ffmpeg -i uncompressed.avi -s 426x240 -pix_fmt yuv420p -c:v libx264 -preset:v veryslow -profile:v main -crf:v 27 -movflags +faststart -c:a libfdk_aac -b:a 128k -t 00:00:10 output.mp4

    And the output:

    ffmpeg version N-55064-g3cd8aaa Copyright (c) 2000-2013 the FFmpeg developers
      built on Jul 29 2013 12:59:12 with gcc 4.8.0 (GCC)
      configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/dominic/GitHub/ffmpeg-windows-build-helpers/sandbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libsoxr --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-libilbc --enable-static --disable-shared --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
      libavutil      52. 40.100 / 52. 40.100
      libavcodec     55. 19.100 / 55. 19.100
      libavformat    55. 12.102 / 55. 12.102
      libavdevice    55.  3.100 / 55.  3.100
      libavfilter     3. 81.103 /  3. 81.103
      libswscale      2.  4.100 /  2.  4.100
      libswresample   0. 17.103 /  0. 17.103
      libpostproc    52.  3.100 / 52.  3.100
    Guessed Channel Layout for  Input Stream #0.1 : stereo
    Input #0, avi, from 'uncompressed.avi':
      Metadata:
        date            : 2012-04-16T16:02:12.00409-07:00
      Duration: 00:02:22.93, start: 0.000000, bitrate: 1199367 kb/s
        Stream #0:0: Video: rawvideo, bgr24, 1920x1080, 23.98 tbr, 23.98 tbn, 23.98 tbc
        Stream #0:1: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 96000 Hz, stereo, flt, 6144 kb/s
    [libx264 @ 000000000038f580] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 000000000038f580] profile Main, level 2.2
    [libx264 @ 000000000038f580] 264 - core 133 r2339 585324f - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x1:0x131 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=27.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output.mp4':
      Metadata:
        date            : 2012-04-16T16:02:12.00409-07:00
        encoder         : Lavf55.12.102
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 426x240, q=-1--1, 24k tbn, 23.98 tbc
        Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 96000 Hz, stereo, s16, 128 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo -> libx264)
      Stream #0:1 -> #0:1 (pcm_f32le -> libfdk_aac)
    Press [q] to stop, [?] for help
    frame=   53 fps=0.0 q=0.0 size=       0kB time=00:00:02.84 bitrate=   0.1kbits/s    
    frame=   98 fps= 97 q=32.0 size=      23kB time=00:00:04.76 bitrate=  38.8kbits/s    
    frame=  151 fps=100 q=32.0 size=      64kB time=00:00:06.68 bitrate=  78.5kbits/s    
    frame=  200 fps= 99 q=32.0 size=     105kB time=00:00:08.60 bitrate=  99.7kbits/s    
    [mp4 @ 00000000023d8e20] Starting second pass: moving header on top of the file
    frame=  240 fps= 87 q=-1.0 Lsize=     244kB time=00:00:10.00 bitrate= 199.8kbits/s    
    
    video:77kB audio:157kB subtitle:0 global headers:0kB muxing overhead 4.142690%
    [libx264 @ 000000000038f580] frame I:2     Avg QP:24.64  size:  8447
    [libx264 @ 000000000038f580] frame P:45    Avg QP:29.82  size:   686
    [libx264 @ 000000000038f580] frame B:193   Avg QP:35.11  size:   159
    [libx264 @ 000000000038f580] consecutive B-frames:  0.8%  0.0%  2.5% 26.7% 22.9% 15.0% 11.7% 16.7%  3.8%
    [libx264 @ 000000000038f580] mb I  I16..4: 41.6%  0.0% 58.4%
    [libx264 @ 000000000038f580] mb P  I16..4:  0.2%  0.0%  0.7%  P16..4: 12.0%  3.7%  5.8%  0.8%  0.3%    skip:76.4%
    [libx264 @ 000000000038f580] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  8.5%  1.5%  0.9%  direct: 0.3%  skip:88.8%  L0:42.5% L1:50.5% BI: 7.0%
    [libx264 @ 000000000038f580] direct mvs  spatial:95.9% temporal:4.1%
    [libx264 @ 000000000038f580] coded y,uvDC,uvAC intra: 76.0% 40.8% 12.1% inter: 1.6% 0.4% 0.0%
    [libx264 @ 000000000038f580] i16 v,h,dc,p: 25% 29%  6% 39%
    [libx264 @ 000000000038f580] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13%  4%  9% 13% 12% 14% 11% 14%
    [libx264 @ 000000000038f580] i8c dc,h,v,p: 21% 48% 21% 10%
    [libx264 @ 000000000038f580] Weighted P-Frames: Y:2.2% UV:2.2%
    [libx264 @ 000000000038f580] ref P L0: 48.5% 11.1% 11.4%  4.7%  4.1%  5.3%  3.6%  1.9%  1.6%  1.5%  0.9%  1.1%  0.9%  1.3%  1.1%  1.1%
    [libx264 @ 000000000038f580] ref B L0: 77.3%  6.0%  5.8%  2.5%  2.5%  2.1%  1.3%  0.5%  0.6%  0.3%  0.3%  0.4%  0.2%  0.2%  0.2%
    [libx264 @ 000000000038f580] ref B L1: 93.9%  6.1%
    [libx264 @ 000000000038f580] kb/s:62.65
    

    The only warning I get is that it has guessed the channel layout for the audio. But, it guessed correctly, so I can’t see how that could be the problem:

    Things I’ve tried:

    • Used libvo_aacenc and aac (with -strict experimental)…same results
    • Tired both of the above on a freely distributable build (compiled without --enable-nonfree) downloaded from here instead of my own build…same results
    • Encoded the same input file with libvorbis…audio works perfectly

    I’m at a loss. The fact that the vorbis encoder works fine makes me think that it can’t be a problem with the input file. But, I can’t understand why AAC is choking on it then. Any ideas where I’m going wrong?

    Update: Here is the output of ffprobe for the file that’s having problems:

    ffprobe version N-54933-g1af9211 Copyright (c) 2007-2013 the FFmpeg developers
      built on Jul 25 2013 18:05:50 with gcc 4.7.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 40.100 / 52. 40.100
      libavcodec     55. 19.100 / 55. 19.100
      libavformat    55. 12.102 / 55. 12.102
      libavdevice    55.  3.100 / 55.  3.100
      libavfilter     3. 81.103 /  3. 81.103
      libswscale      2.  4.100 /  2.  4.100
      libswresample   0. 17.103 /  0. 17.103
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        date            : 2012-04-16T16:02:12.00409-07:00
        encoder         : Lavf55.12.102
      Duration: 00:00:10.03, start: 0.021333, bitrate: 199 kb/s
        Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 426x240, 63 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 96000 Hz, stereo, fltp, 128 kb/s
        Metadata:
          handler_name    : SoundHandler
    

  • Dominic P

    Ok, the issue here seems to be the sample rate. The audio was encoded at 96 kHz which, apparently, Windows Media Player doesn’t support. When I used -ar 48000 to set the sample rate to 48 kHz the audio played perfectly. 96 kHz is probably overkill for web video anyway. Thanks to all who helped.