如何在 MPEG-2 流中找到关键帧,打包在 MPEG-TS 中 [英] How to find keyframe in MPEG-2 stream, packed in MPEG-TS
问题描述
我编写了 MPEG-TS 解复用器.它将传输流解包为 PES 数据包.现在我想删除所有帧,直到遇到关键帧.
I've written MPEG-TS demuxer. It unpacks transport stream to PES packets. Now I want to drop all frames till I meet keyframe.
我该怎么做?我应该在每个 PES 帧中找到 Sequence 块吗?
How can I do it? Should I find for Sequence block in each PES frame?
推荐答案
您应该能够在 MPEG-TS 适配字段.如果您处理的传输流不使用 RAI bits,你需要依赖于包含的基本流中的信息.例如,如果您正在处理 H.264 流,则需要查找 IDR sliceNAL 单元(类型 5).
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).
这篇关于如何在 MPEG-2 流中找到关键帧,打包在 MPEG-TS 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!