<div dir="ltr"><font face="tahoma, sans-serif">Hi guys,</font><div><div><font face="tahoma, sans-serif"><br></font></div></div><div><font face="tahoma, sans-serif">Just need someone to confirm if below code can always get correct frame rate from all formats:</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><pre style="white-space:pre-wrap"><font face="tahoma, sans-serif" color="#ff0000">AVStream *st = pFormatCtx->streams[your_video_index];
double frame_rate = st->r_frame_rate.num / (double)st->r_frame_rate.den;</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif"><br></font></pre><pre style=""><font face="tahoma, sans-serif" style="color:rgb(0,0,0);white-space:pre-wrap">in case of MPEG-2 and H.264 decoders are used where </font><font color="#000000" face="tahoma, sans-serif"><span style="white-space:pre-wrap">pFormatCtx->streams[</span></font><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0);white-space:pre-wrap">your_video_index</span><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif">]->codec->ticks_per_frame = 2,</span></pre><pre style=""><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif">above calculated framerate is actually field rate and actual framerate is only half of it.</span></pre><pre style=""><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></pre><pre style=""><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif">Thanks</span></pre><pre style=""><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></pre><pre style=""><span style="white-space:pre-wrap;color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></pre></div></div>