[FFmpeg-trac] #6703(avformat:new): ffmpeg rounds duration_ts and duration
FFmpeg
trac at avcodec.org
Tue Oct 24 03:49:35 EEST 2017
#6703: ffmpeg rounds duration_ts and duration
-------------------------------------+-------------------------------------
Reporter: mucikiki | Owner:
Type: defect | Status: new
Priority: normal | Component: avformat
Version: git-master | Resolution:
Keywords: mov edts | Blocked By:
duration regression | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by isasi):
The file produced by ffmpeg after encoding "test2.mp4" has different
duration values in "mvhd", "elst" vs in "mdhd" .
This is because ffmpeg is using less-granular "movie timescale" (1000)
than the one used for the stream (30000) . The mdhd duration of 187187 is
actually correct because there are only 187 samples of 1001 duratino each
in stts. However when the ffmpeg MOV muxer adds the mvhd, edts boxes it
rounds the duration to 6240, because of the timescale 1000.
mvhd:
Timescale 1000
Duration 6240
mdhd:
Timescale 30000
Duration 187187
=> 187187/ 30000 ~ 6.239567s
elst:
EntryCount 1
Entry[0].SegmentDuration 6240
Entry[0].MediaTime 2002
When we have -advanced_editlist 1 (which is the default), the edit list
parsing code will correctly set the stream duration based on edit list
segment duration to 6.24s.
When we have -advanced_editlist 0, then the duration is obtained from mdhd
or summing up stts durations, so we have a duration of 6.239567
What we can do here is to change ffmpeg MOV muxer to use a more granular
timescale.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6703#comment:9>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list