[FFmpeg-devel] MPEG index entries

Taylan O. Toygarlar tozgorto
Thu Nov 8 18:31:04 CET 2007


Michael Niedermayer wrote:
 > first, look at AVFMT_GENERIC_INDEX as the related code does already
 > extract keyframe positions, its just limited for raw files not mpeg-ps/ts
 > currently, thought its likely not hard to use it for mpeg-ps/ts as well

I've checked the related code you suggested. The handling of 
AVFMT_GENERIC_INDEX is done in mpegps_read_pes_header, but the call to 
av_add_index_entry in that function has a comment saying /*FIXME: 
keyframe?*/. It wasn't apparent from the code, but I assume the index is 
built without checking for keyframes. (unless presence of (dts != 
AV_NOPTS_VALUE) implies keyframe existance)

Could anyone please verify this assumption of mine?

Secondly, what would be the best alternative to detect whether we came 
accross a keyframe or not?Should I go down to the decoder level, or is 
finding the GOP start position on parser level enough for ffmpeg to jump 
to the keyframe?What is the most common practice that will enable 
jumping to keyframes?

I would appreciate any feedback on this issue.


More information about the ffmpeg-devel mailing list