<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14. Sep 2017, at 13:22, Anton Shekhovtsov <<a href="mailto:shekh.anton@gmail.com" class="">shekh.anton@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">2017-09-14 14:06 GMT+03:00 Info || Non-Lethal Applications <span dir="ltr" class=""><<a href="mailto:info@non-lethal-applications.com" target="_blank" class="">info@non-lethal-applications.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">Hi guys,<br class=""><div class=""><br class=""></div><div class="">I just received a movie file with AAC audio which doesn't play correctly in my player using the ffmpeg libraries.</div><div class="">It sounded “robotic” and the audio ran out of sync rather quickly.</div><div class=""><br class=""></div><div class="">Ffprobe output:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">ffprobe version 3.3.1 Copyright (c) 2007-2017 the FFmpeg developers</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  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</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libavutil      55. 58.100 / 55. 58.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libavcodec     57. 89.100 / 57. 89.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libavformat    57. 71.100 / 57. 71.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libavdevice    57.  6.100 / 57.  6.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libavfilter     6. 82.100 /  6. 82.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libswscale      4.  6.100 /  4.  6.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libswresample   2.  7.100 /  2.  7.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  libpostproc    54.  5.100 / 54.  5.100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/flo/Downloads/<wbr class="">wetransfer-6ec47f/IQT Capture 170911 Unity Round1.mov':</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  Metadata:</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    major_brand     : qt  </span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    minor_version   : 512</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    compatible_brands: qt  </span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    encoder         : Lavf57.66.102</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">  Duration: 00:07:58.81, start: 0.000000, bitrate: 2672 kb/s</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    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)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    Metadata:</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">      handler_name    : DataHandler</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 162 kb/s (default)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">    Metadata:</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">      handler_name    : DataHandler</span></div></div><div class=""><br class=""></div><div class="">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.</div><div class="">While this by itself would not be a problem, it’s very confusing that the AAC decoder outputs AVFrames with a duration of 1024.</div><div class=""><br class=""></div><div class="">So now I’m a bit stuck as I really don’t know what to do.</div><div class="">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.</div><div class="">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:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><b class="">[aac @ 0x10539da00] Got unexpected packet size after a partial decode</b></span></div></div><div class=""><br class=""></div><div class="">The file plays fine in both QuickTime and VLC so there must be a correct way of handling these kind of files..</div><div class=""><br class=""></div><div class="">I’d be very grateful for any insight anyone of you might have!</div><div class=""><br class=""></div><div class="">Thanks and best,</div><div class=""><br class=""></div><div class="">Flo</div></div><br class="">______________________________<wbr class="">_________________<br class="">
Libav-user mailing list<br class="">
<a href="mailto:Libav-user@ffmpeg.org" class="">Libav-user@ffmpeg.org</a><br class="">
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank" class="">http://ffmpeg.org/mailman/<wbr class="">listinfo/libav-user</a><br class="">
<br class=""></blockquote></div><br class=""></div><div class="gmail_extra">What do you mean "packet contains 1100 samples", how is that specified? AVPacket->duration is in time_base units, not in samples.</div></div></div></blockquote><div><br class=""></div></div>The audio stream has a time_base of 1/48000. So does the audio codec context.<div class="">That’s what I find so weird.</div><div class=""><br class=""></div></body></html>