[Libav-user] How to get correct video frame rate

XUANYU HUANG xuanyu.huang at gmail.com
Fri Oct 2 01:49:41 CEST 2015


Hi guys,

Just need someone to confirm if below code can always get correct frame
rate from all formats:

AVStream *st = pFormatCtx->streams[your_video_index];
double frame_rate = st->r_frame_rate.num / (double)st->r_frame_rate.den;


in case of MPEG-2 and H.264 decoders are used where
pFormatCtx->streams[your_video_index]->codec->ticks_per_frame = 2,

above calculated framerate is actually field rate and actual framerate
is only half of it.


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20151002/611d40da/attachment.html>


More information about the Libav-user mailing list