Search code examples
framevideo-processingmpeg

Extracting I-Frames from MPEG 2


I am having to reference MPEG-2 code. My application needs analyze I-frames. Looking at the code I am unable to figure out how exactly this can be done.

Basically I want to extract the first or second I-frame. How do I do that and where do I find the information regarding the frame type?

I would appreciate any direction on this.


Solution

  • I Just wrote this answer: Can you find key frame (I-frame) in h264 video without decoding? i.e. is it in packet?

    which applies to you just as well.

    The start code of picture in MPEG2 is 0x00 . Further, you can see byte 5 - to identify the picture type.

    See here: http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html