<div dir="ltr">Hi!<br><br>I am trying to read exact values for frame rate (fps) from any input video file. I have been trying to debug different structures like AVFormatCtx, etc. but cannot seem to figure it out. For a test case, here is the code I have managed (just the source snippet, include files etc. are all understandable):<br>
<br>//---------------------------------------------------------------------------------------------------------------------------------------------------<br>    // ++ test code begins ++//<br>    av_register_all();<br>    avcodec_register_all();<br>
    avformat_network_init();<br>    avdevice_register_all();<br>    AVFormatContext *pFormatCtx = NULL;<br>    pFormatCtx = avformat_alloc_context();<br>    string finalInputName = "test_input.3gp";<br>    avformat_open_input(&pFormatCtx, finalInputName.c_str(), NULL, NULL);<br>
    if ( pFormatCtx == NULL            ||<br>        pFormatCtx->iformat == NULL    )<br>    {<br>        return -1;<br>    }<br>    // Retrieve stream information<br>    if(avformat_find_stream_info(pFormatCtx, NULL)<0)<br>
        return -1; // Couldn't find stream information<br><br>    // Dump information about file onto standard error<br>    av_dump_format(pFormatCtx, 0, finalInputName.c_str(), 0);<br>    // -- test code ends --//<br>
//---------------------------------------------------------------------------------------------------------------------------------------------------<br><br>The output it gives me is (in debug console):<br><br>//---------------------------------------------------------------------------------------------------------------------------------------------------<br>
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_input.3gp':<br>  Metadata:<br>    major_brand     : 3gp4<br>    minor_version   : 0<br>    compatible_brands: isom3gp4<br>    creation_time   : 2013-05-20 11:54:39<br>
  Duration: 00:00:23.77, start: 0.000000, bitrate: 5882 kb/s<br>    Stream #0:0(eng): Video: mpeg4 (Advanced Simple Profile) (mp4v / 0x7634706D)<br>, yuv420p, 640x480 [SAR 1:1 DAR 4:3], 5752 kb/s, 30.08 fps, 30.08 tbr, 90k tbn,<br>
300 tbc<br>    Metadata:<br>      creation_time   : 2013-05-20 11:54:39<br>      handler_name    : VideoHandle<br>    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 16000 Hz, stereo, s16, 127<br> kb/s<br>    Metadata:<br>
      creation_time   : 2013-05-20 11:54:39<br>      handler_name    : SoundHandle<br>//---------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>Like in above example, I can read that video is recorded at 30.08 fps, question is: it is apparently very simple for FFmpeg to figure this out, but how can I use this information from my own program? I was trying to follow code from FFmpeg source file (utils.c): [void av_dump_format(AVFormatContext *ic,  int index, const char *url, int is_output)], but was easily lost there.<br>
<br>Can anyone kindly guide me how to intercept this problem?<br><br>Thanks in advance for your time...</div>