[Libav-user] Extracting I-Frame intra-prediction modes

Alex Cohn alexcohn at netvision.net.il
Tue Jun 26 12:51:59 CEST 2012


On Tue, Jun 26, 2012 at 12:21 PM, Rouhi Amirhossein2
<amir.rouhi at rmit.edu.au> wrote:
> Hi Misha
> Thanks for prompt reply. That would be a very useful code for extracting key
> frame images. but actually need to extract the intra-prediction modes in
> each key frame of an input video stream. Can you help me to achieve this?
> the input of the program would be an h264 raw video file and the output
> would be a text file that stores intra-prediction modes with related MB
> address and i-frame id.
>
>
> On 26 June 2012 19:12, Misha Penkov <misha.penkov at gmail.com> wrote:
>>
>> On 26 June 2012 18:05, Rouhi Amirhossein2 <amir.rouhi at rmit.edu.au> wrote:
>> >
>> > Hi
>> > You know that in h264, a methos is used for compression which is called
>> > intra prediction method. totally we have 9 intra prediction modes which
>> > showing different direction of top and left side pixels of 4x4 blocks. I
>> > want to extract such modes in any frame that uses intra prediction such
>> > as
>> > I-Frames and IDR,s. Do you know how can i achive this purpose?
>> > In JM software i did the same in decoder, do you think it should be done
>> > in
>> > FFplay as a decoder or it can be done by FFmpeg?
>>
>> AFAIK, H.264 I-frames and keyframes are the same thing.  Once you have
>> an AVFrame, you can check its key_frame member.  It will be non-zero
>> if it's a keyframe (I-frame).
>>
>> For full code, have a look here:
>>
>> https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c
>>
>> Provided that you're using MP4 as the container, you can confirm that
>> the keyframes extracted are indeed I-frames by using the mp4videoinfo
>> utility (http://mpeg4ip.sourceforge.net/documentation/index.php).
>>
>> > Thanks for your expert advice.
>> > Amir
>> >
> --
> Amir H. Rouhi
> PhD Student/ CSIT RMIT University
> Room: 14-09-04
> http://raws.adc.rmit.edu.au/~s3288736/blog2/

Check ffmpeg -debug options, especially pict and mv:

-debug             <flags> EDVAS print specific debug info
   pict                    .DV.. picture info
   mb_type                 .DV.. macroblock (MB) type
   mv                      .DV.. motion vector

Regards,
Alex Cohn


More information about the Libav-user mailing list