Hi Misha<div>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.</div>
<div><br><br><div class="gmail_quote">On 26 June 2012 19:12, Misha Penkov <span dir="ltr"><<a href="mailto:misha.penkov@gmail.com" target="_blank">misha.penkov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 26 June 2012 18:05, Rouhi Amirhossein2 <<a href="mailto:amir.rouhi@rmit.edu.au">amir.rouhi@rmit.edu.au</a>> wrote:<br>
><br>
> Hi<br>
> You know that in h264, a methos is used for compression which is called<br>
> intra prediction method. totally we have 9 intra prediction modes which<br>
> showing different direction of top and left side pixels of 4x4 blocks. I<br>
> want to extract such modes in any frame that uses intra prediction such as<br>
> I-Frames and IDR,s. Do you know how can i achive this purpose?<br>
> In JM software i did the same in decoder, do you think it should be done in<br>
> FFplay as a decoder or it can be done by FFmpeg?<br>
<br>
</div></div>AFAIK, H.264 I-frames and keyframes are the same thing.  Once you have<br>
an AVFrame, you can check its key_frame member.  It will be non-zero<br>
if it's a keyframe (I-frame).<br>
<br>
For full code, have a look here:<br>
<br>
<a href="https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c" target="_blank">https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c</a><br>
<br>
Provided that you're using MP4 as the container, you can confirm that<br>
the keyframes extracted are indeed I-frames by using the mp4videoinfo<br>
utility (<a href="http://mpeg4ip.sourceforge.net/documentation/index.php" target="_blank">http://mpeg4ip.sourceforge.net/documentation/index.php</a>).<br>
<div class="im"><br>
> Thanks for your expert advice.<br>
> Amir<br>
><br>
</div>> _______________________________________________<br>
> Libav-user mailing list<br>
> <a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
><br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Amir H. Rouhi</div>
<div>PhD Student/ CSIT RMIT University</div>
Room: 14-09-04<br><a href="http://raws.adc.rmit.edu.au/%7Es3288736/blog2/" target="_blank">http://raws.adc.rmit.edu.au/~s3288736/blog2/</a><br>
</div>