Manuel Abeledo
Manuel Abeledo

Reputation: 327

Identifying I-Frame in a video container

i'm developing a video server in C on GNU/Linux, and i'm using ffmpeg to manage data of each video file. So, i open the file, get all the information about its container, then do the same with its codec and start reading frames one by one.

Unfortunately, ffmpeg and more precisely avcodec is not very well documented. I need to know when a frame is an I-Frame or a B-Frame to maintain a record, so how could i do it?

Thanks in advance.

Upvotes: 1

Views: 1535

Answers (2)

neuro
neuro

Reputation: 15180

The picture type is given by the pict_type field of struct AVFrame. You have 4 types defined in FFMPEG. pict_type is set to FF_I_TYPE for I Frames.

For example, part of my debug code which give me a letter to set in a debug message :

/* _avframe is struct AVFrame* */

switch(_avframe->pict_type)
{
    case FF_I_TYPE:
        return "I";
        break;
    case FF_P_TYPE:
        return "P";
        break;
    case FF_S_TYPE:
        return "S";
        break;
    case FF_B_TYPE:
        return "B";
        break;

}

Upvotes: 1

jdecuyper
jdecuyper

Reputation: 3963

Manuel,

Have you tried FF-probe yet? It is a multimedia streams analyzer that allows you to see the type of each frame. You can download it from SourceForget.net. To compile it you will need Gnu autoconf, a C compiler and a working installation of the FFmpeg. Let me know if that helps.

Upvotes: 0

Related Questions