[Libav-user] Decoder detects wrong framerate

Vasiliy Volkov volk.vasiliy at gmail.com
Tue Aug 21 12:21:36 EEST 2018

вт, 21 авг. 2018 г. в 11:44, Carl Eugen Hoyos <ceffmpeg at gmail.com>:

> Do you have a sample of a file with wrong values in container that
> gets misdetected by (current) FFmpeg?

Carl, the problem is fundamental. With container we can't be assured that
there is no misconfig there, so in robust solutions we can't rely on it. We
saw such streams, but I have dump for example right now.

You also can observe this bug in FFmpeg. We try to use framerate from
AVCodecContext::framerate, and this value depends on number of threads
specified for AVCodecContext. FFmpeg uses AVStream from libavformat and
there exists two framerates: AVStream::r_frame_rate and
AVStream::avg_frame_rate - and their values are correct, that's why FFmpeg
shows framerate correctly.
But decoder ( AVCodecContext ) in FFmpeg has incorrect framerate, too! You
can check it by simly add printf avctx->framerate into decode() function in
FFmpeg (ffmpeg.c:2231) after avcodec_receive_frame -- it will show you
100/1 fps (incorrect) for more that 1 thread and 50/1 fps (correct) if you
add  -threads 1 for FFmpeg binary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180821/5b6d1841/attachment.html>

More information about the Libav-user mailing list