[FFmpeg-devel] [PATCH] lavf/movenc: Replace dts by pts to calculate duration

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Nov 28 08:38:34 EET 2019



> Am 28.11.2019 um 03:34 schrieb manuelyuan <manuelyuan at 163.com>:
> 
> In this case, the input video is of dynamic frame rate and we don't want to
> duplicate or drop frames, but the output video duration calculated by DTS is
> incorrect, I solved it by using PTS.
> There are many UGC videos with dynamic frame rates, which are represented by
> PTS jumps. After transcoding with ffmpeg -vsync 0 or -vsync 2, the output
> video duration becomes longer.By reading the code of x264/encoder/encoder.c,
> I found that in order to predict the B frame, x264 needs to ensure that there
> are enough reference frames when DTS = 0, so the DTS of these reference frames
> will subtract the cache time. However, the cache time includes the part of PTS
> jumps, which results in the abnormal small DTS.

Do you have access to a stream analyser to verify the output file with your patch?

Carl Eugen


More information about the ffmpeg-devel mailing list