Opened 5 years ago
Closed 5 years ago
#8070 closed defect (fixed)
mov demuxer is broken on fragmented MP4 files with multiple trun boxes per sidx entry
Reported by: | dbuitenh | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avformat |
Version: | git-master | Keywords: | mov regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
FFmpeg makes the assumption that fragmented MP4 files will have exactly one 'trun' box per entry in the 'sidx' box (see here: http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/mov.c;h=24de5429d1d546473c27e7d7291f477ea3fa79d5;hb=HEAD#l4747). This is not the case and the spec explicitly allows multiple 'trun' boxes (chunks) per sidx entry. Other players, browsers, and demuxers handle this corectly. FFmpeg ends up resetting the PTS and DTS at each new trun box, resulting in repeated timestamps.
Sample with multiple trun per sidx (broken): http://chromashift.org/vd.mp4
Sample with single trun per sidx (works): http://chromashift.org/vd2.mp4
How to reproduce:
FFmpeg example:
% ffmpeg -i vd.mp4 -f null - ffmpeg version N-94258-g10f3793823 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8 (Debian 8.3.0-19) configuration: --enable-static --disable-shared libavutil 56. 30.100 / 56. 30.100 libavcodec 58. 53.101 / 58. 53.101 libavformat 58. 28.101 / 58. 28.101 libavdevice 58. 7.100 / 58. 7.100 libavfilter 7. 56.101 / 7. 56.101 libswscale 5. 4.101 / 5. 4.101 libswresample 3. 4.100 / 3. 4.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../chopshop/vd.mp4': Metadata: major_brand : dash minor_version : 0 compatible_brands: dashmp42mp41iso6 creation_time : 2019-08-09T15:55:03.000000Z Duration: 00:01:58.66, start: 0.000000, bitrate: 301 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 426x240, 15 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default) Metadata: creation_time : 2019-08-09T15:55:03.000000Z handler_name : L-SMASH Video Handler encoder : AVC Coding Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to 'pipe:': Metadata: major_brand : dash minor_version : 0 compatible_brands: dashmp42mp41iso6 encoder : Lavf58.28.101 Stream #0:0(und): Video: wrapped_avframe, yuv420p, 426x240, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default) Metadata: creation_time : 2019-08-09T15:55:03.000000Z handler_name : L-SMASH Video Handler encoder : Lavc58.53.101 wrapped_avframe [mov,mp4,m4a,3gp,3g2,mj2 @ 0x563629252700] DTS -2002 < 9009 out of order
FFprobe example:
% ffprobe -show_packets vd.mp4 | grep 'dts=' dts=-2002 dts=-1001 dts=0 dts=1001 dts=2002 dts=3003 dts=4004 dts=5005 dts=6006 dts=7007 dts=8008 dts=9009 dts=-2002 dts=-1001 dts=0 dts=1001 dts=2002 dts=3003 dts=4004 dts=5005 dts=6006 dts=7007 dts=8008 dts=9009 dts=-2002 dts=-1001 dts=0 dts=1001 dts=2002 dts=3003 dts=4004 dts=5005 dts=6006 dts=7007 dts=8008 dts=9009 dts=-2002 dts=-1001 [... snip ...]
Change History (3)
comment:1 by , 5 years ago
Keywords: | regression added; dash mp4 fmp4 removed |
---|---|
Priority: | normal → important |
Reproduced by developer: | set |
comment:3 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed by John Stebbins in 9f4054a0cb27503e535804ab8c2b58cc91c72591
Regression since 4a9d32baca3af0d1831f9556a922c7ab5b426b10, possible duplicate of ticket #7377.