How to find a keyframe in an MPEG-2 stream packaged in MPEG-TS

I wrote an MPEG-TS demuxer. It decompresses the transport stream into PES packets. Now I want to reset all frames until I meet a key frame.

How can i do this? Should I find a Sequence block in every PES frame?

+3
source share
1 answer

You should be able to find the bit of the set random access indicator in the MPEG-TS adaptation field . If you are dealing with a transport stream that does not use RAI bits , you need to rely on the information contained in the elementary stream. For example, if you are processing an H.264 stream, you need to look for units of NAL IDR fragment (type 5).

+2
source

All Articles