goldvideo / demuxer

A tool for demux ts/mp4/flv by typescript. Support HEVC/AVC/AAC codec
MIT License
155 stars 33 forks source link

识别关键帧 #6

Closed zhejinjiang closed 1 year ago

zhejinjiang commented 2 years ago

假设我知道ts文件一定是h265的,那么我怎么知道解码出来的PES包里的数据是关键帧

zhejinjiang commented 2 years ago

new TSDemux({ enableWorker: false, debug: false, onlyDemuxElementary: true, })

gemxx commented 2 years ago

假设我知道ts文件一定是h265的,那么我怎么知道解码出来的PES包里的数据是关键帧

可以参考ffmpeg的判断#define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23)

IRAP(Intra Random Access Pictures)

zhejinjiang commented 1 year ago

PES包的data里前6位不知道啥意思,后面的0001是起始码前缀. 取第11位计算及(data[10] & 0x7E)>>1 , 19 为I帧, 32为VPS, 33为SPS,34为PPS, 39为SEI