[FFmpeg-user] converting raw video in mkv to y4m looses framerate.

Andy Furniss adf.lists at gmail.com
Mon Jul 27 17:19:40 CEST 2015


Moritz Barsnick wrote:
> On Mon, Jul 27, 2015 at 15:19:01 +0100, Andy Furniss wrote:
>> The overhead is a bit high! but the framerate looks good.
>
> :-)
>
>> Anyway players will play the vid but think it's 1000 fps ffmpeg -i
>> below.
>
> I tried to reproduce, and noticed that indeed the y4m header (very
> easy to read, check here:
> http://wiki.multimedia.cx/index.php?title=YUV4MPEG2) says 1000 fps.
>
> If I run ffmpeg with "-r 60" as an output option, the framerate is
> recorded correctly in the y4m header, see this text diff of the two
> output files, which are otherwise identical:
>
> +YUV4MPEG2 W3840 H2160 F1000:1 Ip A1:1 C420jpeg XYSCSS=420JPEG
> -YUV4MPEG2 W3840 H2160 F60:1 Ip A1:1 C420jpeg XYSCSS=420JPEG
>
> So, that's your workaround.
>
> If I dare to stab at the root cause of the problem: It might be this
> code in libavformat/yuv4mpegenc.c, in yuv4_generate_header():
>
> // TODO: should be avg_frame_rate av_reduce(&raten, &rated,
> st->time_base.den, st->time_base.num, (1UL << 31) - 1);
>
> It shows that the time base of the input stream "st" is being used,
> and not the frame rate. (av_reduce() creates numerator and
> denominator, to be able to create the quoted string "F1000:1".) And
> the time base of the input is indeed "1k", as seen in your logs. This
> may be a bug, and the "TODO" may have something to do (excuse the
> pun) with that.

That was quick - thanks for looking -r 60 it will be - I would count
it as a bug especially as the output says 60fps.


More information about the ffmpeg-user mailing list