[Libav-user] AAC decode problems

Info || Non-Lethal Applications info at non-lethal-applications.com
Thu Sep 14 14:06:20 EEST 2017

Hi guys,

I just received a movie file with AAC audio which doesn't play correctly in my player using the ffmpeg libraries.
It sounded “robotic” and the audio ran out of sync rather quickly.

Ffprobe output:

ffprobe version 3.3.1 Copyright (c) 2007-2017 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/flo/Downloads/wetransfer-6ec47f/IQT Capture 170911 Unity Round1.mov':
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf57.66.102
  Duration: 00:07:58.81, start: 0.000000, bitrate: 2672 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 2499 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      handler_name    : DataHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 162 kb/s (default)
      handler_name    : DataHandler

By examining the file I found out that the packet durations of the AAC stream were not 1024 as they are with all the other files I have but rather either 1000 or 1100.
While this by itself would not be a problem, it’s very confusing that the AAC decoder outputs AVFrames with a duration of 1024.

So now I’m a bit stuck as I really don’t know what to do.
If the packets were all 1000 I would try discarding the last 24 samples of each AVFrame but as the frame apparently only holds 1024 samples although the packet says it contains 1100 samples, I’m stuck.
I tried sending a NULL packet in the case of longer packets hoping to get the remains 76 samples out of the decoder but I got this error message:

[aac @ 0x10539da00] Got unexpected packet size after a partial decode

The file plays fine in both QuickTime and VLC so there must be a correct way of handling these kind of files..

I’d be very grateful for any insight anyone of you might have!

Thanks and best,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170914/6ba0921d/attachment.html>

More information about the Libav-user mailing list