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

mypopy at gmail.com mypopy at gmail.com
Fri Nov 8 05:03:39 EET 2019


On Fri, Nov 8, 2019 at 10:58 AM manuelyuan <manuelyuan at 163.com> wrote:
>
> I have try to make fate again and it still works, I do not know why it breaks fate-binsub-movtextenc on your side
> My steps are:
> 1、./configure
> 2、make fate
> If I'm wrong, what should I do?
>
>
> At 2019-11-08 02:21:16, "Michael Niedermayer" <michael at niedermayer.cc> wrote:
> >On Thu, Nov 07, 2019 at 05:55:18PM +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 ++
> >>  tests/ref/fate/movenc | 20 ++++++++++----------
> >>  tests/ref/lavf/mov    |  4 ++--
> >>  tests/ref/lavf/mp4    |  4 ++--
> >>  5 files changed, 30 insertions(+), 23 deletions(-)
> >
> >breaks fate-binsub-movtextenc
> >...
> >
> >[mp4 @ 0x29327c0] Estimating the duration of the last packet in a fragment, consider setting the duration field in AVPacket instead.
> >size=       1kB time=00:00:05.85 bitrate=   1.3kbits/s speed=6.03e+04x
> >video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1809.803955%
> >make: *** [fate-binsub-movtextenc] Error 1
> >
> >[...]
> >--

Please try: make fate-binsub-movtextenc, tks


More information about the ffmpeg-devel mailing list