How to find keyframe in MPEG-2 stream, packed in MPEG-TS
I've written MPEG-TS demuxer. It unpacks transport stream to PES packets. Now I want to drop all frames till I meet keyframe.
How can I do it? Should I find fo开发者_运维百科r Sequence block in each PES frame?
You should be able to look for a set Random Access Indicator bit in the MPEG-TS adaptation field. If you are dealing with a transport stream that does not use RAI bits, you'll need to rely on information in the contained elementary stream. For example, if you are processing an H.264 stream, you'll need to look for IDR slice NAL units (type 5).
iframes works with h262,h264, and h265
精彩评论