04-04-2006 08:32 AM
I have a question. I can use IPP sample code to getthe framesone by one from a MPEG2 file. However, if I want togeta specified frame, for example, the 1000th frame, but I don't want to get framesfrom the beginning of thefile.How to do? Please give me a hint. Thanks.
04-06-2006 04:19 PM
Suppose you can change position in decoded bitstream.
Each GOP header contain information about current second and a number of the first frame of the GOP in that second. In display order.
So the number is gop_second*frame_rate + gop_picture.
The number is relative, becausefirst frame can have other than 0 value.
If frame rate is not integer, round it to closest integer.
But not all the streams contain such information in GOP header.
2nd way. For sytem streams.
Use PTS difference and frame_rate. PTS can come not with every frame, but it is possible to get sync. PTS==-1 means that it is absent in current portion of data.
In both cases you should start decoding from the start of containing GOP, or even from previous.