#1755 closed defect (fixed)
Incorrect timestamps for aac in avi
Reported by: | Heesuk Jung | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | avi aac pts |
Cc: | dwkang@google.com, myungchul.kim@lge.com, suhwang.kim@lge.com, woojun.jung@lge.com, donggul.kim@lge.com, hojae.lee@lge.com, kubong.min@lge.com | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
Audio become silent before playback reach end of file.
Video end at about 31 sec but audio stopped about 12 sec.
I reviewed audio and video PTS information using ffprobe tool.
Please refer the PTS plotting graph as below.
(Notice! Recommend download of PTS plotting file because of Google docs excel inter-operability)
- PTS plotting link : https://docs.google.com/open?id=0B6r7ZfWFIypCbnRtVlFTVVA0cEU
- Problematic file link : https://docs.google.com/open?id=0B6r7ZfWFIypCeXB3b2J5S1NDMzQ
My Analysis of PTS
- Video PTS is OK.
- Audio PTS is NG.
- Whole timeline of this media file is about 31 sec but audio pts has about 12 sec timeline.
- Also values of Audio PTS are grouped as special pattern.
- Simplified Audio PTS pattern : 0, 0, 0, 1, 1, 2, 2, ……. , N/3
- Simplified Video PTS pattern : 0, 1, 2, …. , N
-> The shape of audio PTS make 2 problem.
1) Audio stop early. Because audio PTS by ffmpeg have 12 sec but real audio has 30 sec.
2) Seek does not work after 12 sec.
- My co-worker checked audio PTS information of problematic based on avidemux and Audio PTS is just OK.
- And so I request that FFmpeg team inspect this problem.
How to reproduce:
% ffplay 016_avi_mpeg4_sp[720@24fps]_aac[2ch_128kbps_44.1khz].avi[MV]_origin.avi
Attachments (5)
Change History (16)
comment:1 by , 12 years ago
Keywords: | Grouped Audio PTS removed |
---|
comment:2 by , 12 years ago
Analyzed by developer: | unset |
---|---|
Reproduced by developer: | unset |
comment:3 by , 12 years ago
I update complete console output as below.
shkim81@GuHaRa:~/ffmpeg-0.11.1$ ./ffplay ~/AVI/016_avi_mpeg4_sp\[720@24fps\]_aac\[2ch_128kbps_44.1khz\].avi\[MV\]_origin.avi ffplay version 0.11.1 Copyright (c) 2003-2012 the FFmpeg developers built on Jun 27 2012 21:31:24 with gcc 4.4.3 configuration: --prefix=/home/2.Study/1.ffmepg/ffmpeg --disable-yasm --enable-shared libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 [avi @ 0x23b7ce0] non-interleaved AVI Input #0, avi, from '/home/shkim81/MediaDB_GCD/1_SIC_USB/CompatibilityFullPackage/AVI/016_avi_mpeg4_sp[720@24fps]_aac[2ch_128kbps_44.1khz].avi[MV]_origin.avi': Metadata: encoder : PotEncoder Duration: 00:00:31.00, start: 0.000000, bitrate: 6907 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 tbr, 24 tbn, 24 tbc Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, s16, 128 kb/s 36.69 A-V: -0.021 fd= 5 aq= 0KB vq= 0KB sq= 0B f=0/0 f=0/0
comment:4 by , 12 years ago
Don't you agree that the problem can be much better seen in ffplay's output if you stop playback after ~11 seconds?
Please test current git head.
comment:5 by , 12 years ago
Hi cehoyos,
I don't think so because a/v playback of other player such as Avidemux works well until end of stream.
Also avidemux extracts the complete audio pts information of problematic files.
I recommend that you play the probemlatic file using avidemux player.
Test result of ffmpeg latest mater branch is same as ffmpeg 0.11.1.
hsjung@hsjung-laptop:~/utils/ffmpeg$ ./ffplay /media/LGEXT/Sanity_Test/1_SIC_USB/CompatibilityFullPackage/AVI/016_avi_mpeg4_sp\[720@24fps\]_aac\[2ch_128kbps_44.1khz\].avi\[MV\]_origin.avi ffplay version git-2012-09-20-16e52c8 Copyright (c) 2003-2012 the FFmpeg developers built on Sep 20 2012 18:00:20 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab libavutil 51. 73.101 / 51. 73.101 libavcodec 54. 56.100 / 54. 56.100 libavformat 54. 27.101 / 54. 27.101 libavdevice 54. 2.100 / 54. 2.100 libavfilter 3. 16.104 / 3. 16.104 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 [avi @ 0x26eb3e0] non-interleaved AVI Input #0, avi, from '/media/LGEXT/Sanity_Test/1_SIC_USB/CompatibilityFullPackage/AVI/016_avi_mpeg4_sp[720@24fps]_aac[2ch_128kbps_44.1khz].avi[MV]_origin.avi': Metadata: encoder : PotEncoder Duration: 00:00:31.00, start: 0.000000, bitrate: 6907 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 tbr, 24 tbn, 24 tbc Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, s16, 128 kb/s Frame changed from size:0x0 to size:1280x720 vq= 205KB sq= 0B f=0/0 31.56 A-V: -0.038 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 f=0/0 hsjung@hsjung-laptop:~/utils/ffmpeg$
Thanks
comment:6 by , 12 years ago
Keywords: | avi aac pts added |
---|---|
Reproduced by developer: | set |
Status: | new → open |
Summary: | Audio becomes silent on some avi files. (This problem is reproduced during 1x play and seek) → Incorrect timestamps for aac in avi |
Version: | 0.11.1 → git-master |
Audio timestamps for the sample file (uploaded to samples/ffmpeg-bugs/trac/ticket1755) are wrong with lavf, ffplay tries to correct it by playing video too slow, leading to A/V-desync, same wrong timestamps are shown with mplayer -demuxer lavf, the file plays fine with mplayer -demuxer avi
$ time ffplay 016_avi_mpeg4_sp\[720\@24fps\]_aac\[2ch_128kbps_44.1khz\].avi\[MV\]_origin.avi ffplay version N-44632-ga16c512 Copyright (c) 2003-2012 the FFmpeg developers built on Sep 20 2012 16:11:00 with gcc 4.5.3 (GCC) configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl libavutil 51. 73.101 / 51. 73.101 libavcodec 54. 56.100 / 54. 56.100 libavformat 54. 27.101 / 54. 27.101 libavdevice 54. 2.101 / 54. 2.101 libavfilter 3. 16.105 / 3. 16.105 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 [avi @ 0x151eb20] non-interleaved AVI Input #0, avi, from '016_avi_mpeg4_sp[720@24fps]_aac[2ch_128kbps_44.1khz].avi[MV]_origin.avi': Metadata: encoder : PotEncoder Duration: 00:00:31.00, start: 0.000000, bitrate: 6907 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 tbr, 24 tbn, 24 tbc Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, s16, 128 kb/s Frame changed from size:0x0 to size:1280x720 9.98 A-V: -2.689 fd= 0 aq= 118KB vq= 233KB sq= 0B f=0/0 f=0/0 real 0m25.429s user 0m2.105s sys 0m0.218s
ffmpeg corrects the timestamps, resulting video seems fine afaict:
$ ffmpeg -i 016_avi_mpeg4_sp\[720\@24fps\]_aac\[2ch_128kbps_44.1khz\].avi\[MV\]_origin.avi -qscale 2 out.avi ffmpeg version N-44632-ga16c512 Copyright (c) 2000-2012 the FFmpeg developers built on Sep 20 2012 16:11:00 with gcc 4.5.3 (GCC) configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl libavutil 51. 73.101 / 51. 73.101 libavcodec 54. 56.100 / 54. 56.100 libavformat 54. 27.101 / 54. 27.101 libavdevice 54. 2.101 / 54. 2.101 libavfilter 3. 16.105 / 3. 16.105 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 [avi @ 0x14f0240] non-interleaved AVI Input #0, avi, from '016_avi_mpeg4_sp[720@24fps]_aac[2ch_128kbps_44.1khz].avi[MV]_origin.avi': Metadata: encoder : PotEncoder Duration: 00:00:31.00, start: 0.000000, bitrate: 6907 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 tbr, 24 tbn, 24 tbc Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, s16, 128 kb/s Please use -q:a or -q:v, -qscale is ambiguous Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf54.27.101 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 24 tbn, 24 tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, flt, 192 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 -> mpeg4) Stream #0:1 -> #0:1 (aac -> ac3) Press [q] to stop, [?] for help [avi @ 0x150b000] st:0 PTS: 3 DTS: 3 < 6 invalid, clipping [avi @ 0x150b000] st:0 PTS: 3 DTS: 3 < 7 invalid, clipping [avi @ 0x150b000] st:0 PTS: 4 DTS: 4 < 8 invalid, clipping [avi @ 0x150b000] st:0 PTS: 5 DTS: 5 < 9 invalid, clipping [avi @ 0x150b000] st:0 PTS: 6 DTS: 6 < 10 invalid, clipping [avi @ 0x150b000] st:0 PTS: 5 DTS: 5 < 11 invalid, clipping [avi @ 0x150b000] st:0 PTS: 6 DTS: 6 < 12 invalid, clipping [avi @ 0x150b000] st:0 PTS: 7 DTS: 7 < 13 invalid, clipping [avi @ 0x150b000] st:0 PTS: 7 DTS: 7 < 14 invalid, clipping [avi @ 0x150b000] st:0 PTS: 7 DTS: 7 < 15 invalid, clipping [avi @ 0x150b000] st:0 PTS: 8 DTS: 8 < 16 invalid, clipping [avi @ 0x150b000] st:0 PTS: 8 DTS: 8 < 17 invalid, clipping [avi @ 0x150b000] st:0 PTS: 9 DTS: 9 < 18 invalid, clipping [avi @ 0x150b000] st:0 PTS: 9 DTS: 9 < 19 invalid, clipping [avi @ 0x150b000] st:0 PTS: 10 DTS: 10 < 20 invalid, clipping [avi @ 0x150b000] st:0 PTS: 9 DTS: 9 < 21 invalid, clipping [avi @ 0x150b000] st:0 PTS: 10 DTS: 10 < 22 invalid, clipping [avi @ 0x150b000] st:0 PTS: 11 DTS: 11 < 23 invalid, clipping [avi @ 0x150b000] st:0 PTS: 11 DTS: 11 < 24 invalid, clipping [avi @ 0x150b000] st:0 PTS: 11 DTS: 11 < 25 invalid, clipping [avi @ 0x150b000] st:0 PTS: 12 DTS: 12 < 26 invalid, clipping [avi @ 0x150b000] st:0 PTS: 12 DTS: 12 < 27 invalid, clipping [avi @ 0x150b000] st:0 PTS: 13 DTS: 13 < 28 invalid, clipping [avi @ 0x150b000] st:0 PTS: 13 DTS: 13 < 29 invalid, clipping [avi @ 0x150b000] st:0 PTS: 14 DTS: 14 < 30 invalid, clipping [avi @ 0x150b000] st:0 PTS: 14 DTS: 14 < 31 invalid, clipping [avi @ 0x150b000] st:0 PTS: 14 DTS: 14 < 32 invalid, clipping [avi @ 0x150b000] st:0 PTS: 15 DTS: 15 < 33 invalid, clipping [avi @ 0x150b000] st:0 PTS: 15 DTS: 15 < 34 invalid, clipping [avi @ 0x150b000] st:0 PTS: 15 DTS: 15 < 35 invalid, clipping [avi @ 0x150b000] st:0 PTS: 16 DTS: 16 < 36 invalid, clipping [avi @ 0x150b000] st:0 PTS: 16 DTS: 16 < 37 invalid, clipping [avi @ 0x150b000] st:0 PTS: 17 DTS: 17 < 38 invalid, clipping [avi @ 0x150b000] st:0 PTS: 17 DTS: 17 < 39 invalid, clipping ... [avi @ 0x150b000] st:0 PTS: 341 DTS: 341 < 861 invalid, clipping [avi @ 0x150b000] st:0 PTS: 341 DTS: 341 < 862 invalid, clipping [avi @ 0x150b000] st:0 PTS: 341 DTS: 341 < 863 invalid, clipping [avi @ 0x150b000] st:0 PTS: 342 DTS: 342 < 864 invalid, clipping [avi @ 0x150b000] st:0 PTS: 342 DTS: 342 < 865 invalid, clipping [avi @ 0x150b000] st:0 PTS: 343 DTS: 343 < 866 invalid, clipping [avi @ 0x150b000] st:0 PTS: 343 DTS: 343 < 867 invalid, clipping [avi @ 0x150b000] st:0 PTS: 344 DTS: 344 < 868 invalid, clipping [avi @ 0x150b000] st:0 PTS: 343 DTS: 343 < 869 invalid, clipping [avi @ 0x150b000] st:0 PTS: 344 DTS: 344 < 870 invalid, clipping [avi @ 0x150b000] st:0 PTS: 344 DTS: 344 < 871 invalid, clipping [avi @ 0x150b000] st:0 PTS: 345 DTS: 345 < 872 invalid, clipping [avi @ 0x150b000] st:0 PTS: 345 DTS: 345 < 873 invalid, clipping [avi @ 0x150b000] st:0 PTS: 346 DTS: 346 < 874 invalid, clipping [avi @ 0x150b000] st:0 PTS: 346 DTS: 346 < 875 invalid, clipping [avi @ 0x150b000] st:0 PTS: 346 DTS: 346 < 876 invalid, clipping [avi @ 0x150b000] st:0 PTS: 347 DTS: 347 < 877 invalid, clipping [avi @ 0x150b000] st:0 PTS: 347 DTS: 347 < 878 invalid, clipping [avi @ 0x150b000] st:0 PTS: 347 DTS: 347 < 879 invalid, clipping [avi @ 0x150b000] st:0 PTS: 348 DTS: 348 < 880 invalid, clipping [avi @ 0x150b000] st:0 PTS: 349 DTS: 349 < 881 invalid, clipping [avi @ 0x150b000] st:0 PTS: 349 DTS: 349 < 882 invalid, clipping [avi @ 0x150b000] st:0 PTS: 349 DTS: 349 < 883 invalid, clipping [avi @ 0x150b000] st:0 PTS: 350 DTS: 350 < 884 invalid, clipping [avi @ 0x150b000] st:0 PTS: 350 DTS: 350 < 885 invalid, clipping [avi @ 0x150b000] st:0 PTS: 350 DTS: 350 < 886 invalid, clipping frame= 744 fps= 94 q=2.0 Lsize= 36906kB time=00:00:31.00 bitrate=9752.7kbits/s video:36133kB audio:725kB subtitle:0 global headers:0kB muxing overhead 0.131191%
comment:7 by , 12 years ago
I have already understood that audio timestamp extracted lavf was wrong as previous linked pts plotting.
I wonder if ffmpeg has some idea to improve this problem or not.
Actually, I found that 1x playback is ok using decoder free run mode.
(Decoder decide pts information without receiving parser pts.)
But I knew that it is so hard to improve seek problem.
FFmpeg parser get wrong frames because of wrong pts information.
At least, I hope to find solution for seek problem.
Thanks.
by , 12 years ago
Attachment: | frameInfo_withoutPatch.txt added |
---|
Original Frame information based on ffprobe
by , 12 years ago
Attachment: | frameInfo_withPatch.txt added |
---|
Patch applied frame information based on ffprobe
comment:8 by , 12 years ago
Hi cehoyos,
I fixed this issue.
Please refer my summary as below.
Use sample size in case incorrect timestamps for aac in AVI (Ticket #1755)
In some case for aac in AVI, avidec extracts wrong PTS value.
(www.ffmpeg.org/trac/ffmpeg/ticket/1755)
In getDuration function, I suggest using sample size instead of len.
I attached 4 files.
- avidec.c
- In latest master, I merged my patch into avidec.c
- avidec.patch
- patch file
- frameInfo_withoutPatch.txt
- There are frame informations without patch. As you know, PTS value is wrong.
- 1X playback is NG and seek is NG too.
- frameInfo_withPatch.txt
- There are frame informations without patch. As you know, PTS value is ok.
- 1X playback is ok and seek is ok too.
Also I have done regression test in our media pool.
Test result of 11 problematic files is ok after patch apply.
(11 files have fixed sample size in AVI Stream Header)
Regression test reseult of 4 non-problematic files is ok after patch apply.
(4 files have variable sample size in AVI Stream Header)
I have 1 question to commit change.
I got ffmpeg master branch but master git is read-only and so
I hope to know how I can submit change into master branch?
(I want to know change commit process or needing some admission.)
Thanks
comment:9 by , 12 years ago
Please send your patch to ffmpeg-devel, patches generally receive more attention there.
comment:10 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fixed by Michael, please report if some files still fail for you!
by , 12 years ago
Attachment: | 0001-PATCH-Use-sample-size-in-case-incorrect-timestamps-f.patch added |
---|
update patch considering additional problem case
comment:11 by , 12 years ago
I found more problem case and so add condition based on Michael patch.
Thanks!
Is this also reproducible with current git head?
To make this a valid ticket, please add command line together with complete, uncut console output.