简体   繁体   English

解码时如何从android mediacodec检查​​关键帧

[英]How to check key frame from android mediacodec when decoding

Can we check whether a frame is a key frame when decoding using mediacodec? 使用mediacodec解码时,能否检查帧是否为关键帧?

I've already tried MediaCodec.BufferInfo.flags & BUFFER_FLAG_KEY_FRAME , but as the doc says, it's for encoding. 我已经尝试过MediaCodec.BufferInfo.flags & BUFFER_FLAG_KEY_FRAME ,但是正如文档所说,它用于编码。

A simple way is to check the NALU's header code before passing it to the decoder : 一种简单的方法是在将NALU的标头代码传递给解码器之前对其进行检查:

0x00 0x00 0x00 0x01 0x67 -> SPS 
0x00 0x00 0x00 0x01 0x68 -> PPS 
0x00 0x00 0x00 0x01 0x65 -> I-frame (Key frame) 
0x00 0x00 0x00 0x01 0x21 -> P-frame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM