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

Michael Niedermayer michael at niedermayer.cc
Wed Nov 6 18:47:42 EET 2019


On Wed, Nov 06, 2019 at 10:36:11AM +0800, manuelyuan wrote:
> From: Mengyang Yuan <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.
> 
> Signed-off-by: Mengyang Yuan <manuelyuan at 163.com>
> ---
>  libavformat/movenc.c | 23 ++++++++++++++---------
>  libavformat/movenc.h |  2 ++
>  2 files changed, 16 insertions(+), 9 deletions(-)

this breaks make fate / changes checksums
if the changes are intended, the references would need to be updated
with the patch doing the change

make: *** [fate-lavf-mp4] Error 1
make: *** [fate-lavf-mov] Error 1
make: *** [fate-binsub-movtextenc] Error 1
make: *** [fate-movenc] Error 1

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191106/2ff3f865/attachment.sig>


More information about the ffmpeg-devel mailing list