[FFmpeg-devel] MPEG index entries

Vinod G design4mmedia
Wed Nov 14 03:17:18 CET 2007


Hi,

I have been working on a similar problem, so let me share my findings.

You are right that the indexes generated inside mpegps_read_pes_header
are not keyframe indexes. But I still use those indexes for the seek.
After the seek, when I read a frame, I check the 'picture coding type'
to check for I-frame. If it is not I-frame, I skip frames until I find
one. This works reasonably, but not perfect.

Ideally, the initial indexing (or indexing while playing), should
check for I-frames in each frame's 'picture coding type' and then add
it into the index table.

Thanks,

On Nov 8, 2007 9:31 AM, Taylan O. Toygarlar <tozgorto at science.uva.nl> wrote:
> Hi,
>
> 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.
>
> --
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>




More information about the ffmpeg-devel mailing list