[FFmpeg-user] How to build a Index of I frames?

99191957 at qq.com 99191957 at qq.com
Thu Aug 8 03:32:58 CEST 2013


I want to make a index of key frames' location of a video, but I found in some kind of H.264 video--not all I frame are Keyframe, for example:
 type : I , is Key: no. So, i can not judge by packet.flag.   
I tried:

int _find_head(unsigned char *buffer, int len)
{
 int i;
 BOOL isMatch=FALSE;
 for (i=0;i<len;i++){
  if (buffer[i] == 0 && buffer[i+1] == 0 && buffer[i+2] == 0 && buffer[i+3] == 1 && buffer[i+4]==0x67){
   isMatch=TRUE;
   break;
  }
 }

call _find_head(packet.date,packet.size) to find Iframe head, but it does not work either.
So, i'm wordering if anyone could help. Thx. 




99191957 at qq.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 10027 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130808/9e35565c/attachment.png>


More information about the ffmpeg-user mailing list