[FFmpeg-trac] #3558(undetermined:new): "-fflags +igndts" generates wrong dts when rewrapping some ts files to mp4
FFmpeg
trac at avcodec.org
Fri Apr 18 18:47:49 CEST 2014
#3558: "-fflags +igndts" generates wrong dts when rewrapping some ts files to mp4
-------------------------------------+-------------------------------------
Reporter: wim_arbor | Owner:
Type: defect | Status: new
Priority: wish | Component:
Version: git-master | undetermined
Keywords: mov | Resolution:
Blocking: | Blocked By:
Analyzed by developer: 0 | Reproduced by developer: 0
-------------------------------------+-------------------------------------
Comment (by wim_arbor):
Replying to [comment:4 cehoyos]:
> Replying to [comment:3 wim_arbor]:
> > Replying to [comment:2 cehoyos]:
> > > Replying to [ticket:3558 wim_arbor]:
> > > > Without {{{-fflags +igndts}}} a proper output is created.
> > >
> > > I don't understand: Why do you add this option if it breaks
remuxing?
> >
> > I also have files which require this option to be able to remux or
transcode.
>
> Could you add such a sample for completeness?
I have attached such a sample. Here is the diagnostics I performed on that
file;
Starting with the first I-Frame, attachment:dts_error_refbframe.ts
contains the following values for PTS/DTS (PID 481/video):
754: PTS: 5562850426 DTS: 5562846826
821: PTS: 5562864826 DTS: 5562850426
859: PTS: 5562857626
866: PTS: 5562854026
875: PTS: 5562861226
879: PTS: 5562879226 DTS: 5562864826
891: PTS: 5562872026
902: PTS: 5562868426
905: PTS: 5562875626
908: PTS: 5562893626 DTS: 5562879226
It looks like the B-Frame with PTS=5562857626 is used as a reference
frame. So this stream is correctly in decoding order, as that frame must
be decoded before the frame with PTS=5562854026. But it needs a different
(lower) DTS. So this file is no valid stream. (to be clear, it is not
generated with ffmpeg).
Remuxing with ffmpeg without {{{-fflags +igndts}}} fails:
{{{
arbor at debian7:~$ bin/ffmpeg -y -i dts_error_refbframe.ts -f mov -c:a copy
-c:v copy -bsf:a aac_adtstoasc out.mp4
ffmpeg version N-62439-g5e379cd Copyright (c) 2000-2014 the FFmpeg
developers
built on Apr 14 2014 13:41:14 with gcc 4.7 (Debian 4.7.2-5)
...
[mpegts @ 0x30549c0] DTS 5562792826 < 5562796426 out of order
...
Press [q] to stop, [?] for help
[mov @ 0x21cc440] Non-monotonous DTS in output stream 0:0; previous:
130560, current: 130560; changing to 130561. This may result in incorrect
timestamps in the output file.
[mov @ 0x21cc440] pts (126960) < dts (130561) in stream 0
av_interleaved_write_frame(): Invalid argument
frame= 4 fps=0.0 q=-1.0 Lsize= 33kB time=00:00:01.45 bitrate=
186.1kbits/s
video:17kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 2.363399%
}}}
No problem that this fails, the DTS is wrong in the input file.
But with {{{-fflags +igndts}}} it succeeds;
{{{
arbor at debian7:~$ bin/ffmpeg -y -fflags +igndts -i dts_error_refbframe.ts
-f mov -c:a copy -c:v copy -bsf:a aac_adtstoasc out.mp4
ffmpeg version N-62439-g5e379cd Copyright (c) 2000-2014 the FFmpeg
developers
built on Apr 14 2014 13:41:14 with gcc 4.7 (Debian 4.7.2-5)
...
[mpegts @ 0x20e3a20] DTS 5562792826 < 5562796426 out of order
...
Input #0, mpegts, from 'dts_error_refbframe.ts':
Duration: 00:00:11.37, start: 61808.078511, bitrate: 1322 kb/s
Program 1
Stream #0:0[0x1e1]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1e2]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz,
stereo, fltp, 127 kb/s
Output #0, mov, to 'out.mp4':
Metadata:
encoder : Lavf55.37.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 720x576 [SAR
64:45 DAR 16:9], q=2-31, 25 fps, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 127
kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 251 fps=0.0 q=-1.0 Lsize= 1405kB time=00:00:11.29
bitrate=1019.4kbits/s
video:1229kB audio:167kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.648900%
}}}
There are other errors in the output because the file was not cut at an
I-Frame.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3558#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list