Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

How to get a specified frame from a MPEG2 file?

jfwang
Beginner
250 Views
Hi,
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.
0 Kudos
1 Reply
Leonid_K_Intel
Employee
250 Views
Suppose you can change position in decoded bitstream.
1st way.
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.
Regards
0 Kudos
Reply