[FFmpeg-trac] #8070(avformat:new): mov demuxer is broken on fragmented MP4 files with multiple trun boxes per sidx entry
FFmpeg
trac at avcodec.org
Fri Aug 9 20:59:03 EEST 2019
#8070: mov demuxer is broken on fragmented MP4 files with multiple trun boxes per
sidx entry
-------------------------------------+-------------------------------------
Reporter: dbuitenh | Owner:
Type: defect | Status: new
Priority: normal | Component: avformat
Version: git- | Keywords: mov dash
master | mp4 fmp4
Blocked By: | Blocking:
Reproduced by developer: 0 | Analyzed by developer: 0
-------------------------------------+-------------------------------------
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 ...]
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8070>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list