H265 帧类型判断

请狗日的360doc不要转载。

参见ffmpeg中hevcdec.c hevc_probe函数(我的ffmpeg版本2.8.2)
和264的&0x1f不同。265是
int type = (code & 0x7E)>>1;

        switch (type) {
        case NAL_VPS:        vps++;  break;
        case NAL_SPS:        sps++;  break;
        case NAL_PPS:        pps++;  break;
        case NAL_BLA_N_LP:
        case NAL_BLA_W_LP:
        case NAL_BLA_W_RADL:
        case NAL_CRA_NUT:
        case NAL_IDR_N_LP:
        case NAL_IDR_W_RADL: irap++; break;
        }
这里应该是统计帧个数的。可以看出NAL_BLA_N_LP到NAL_IDR_W_RADL都算I帧。

对此ffmpeg 中 hevc.h 如下定义
NAL_TRAIL_N = 0,
NAL_TRAIL_R = 1,
NAL_TSA_N = 2,
NAL_TSA_R = 3,
NAL_STSA_N = 4,
NAL_STSA_R = 5,
NAL_RADL_N = 6,
NAL_RADL_R = 7,
NAL_RASL_N = 8,
NAL_RASL_R = 9,
NAL_BLA_W_LP = 16,
NAL_BLA_W_RADL = 17,
NAL_BLA_N_LP = 18,
NAL_IDR_W_RADL = 19,
NAL_IDR_N_LP = 20,
NAL_CRA_NUT = 21,
NAL_VPS = 32,
NAL_SPS = 33,
NAL_PPS = 34,
NAL_AUD = 35,
NAL_EOS_NUT = 36,
NAL_EOB_NUT = 37,
NAL_FD_NUT = 38,
NAL_SEI_PREFIX = 39,
NAL_SEI_SUFFIX = 40,

我的猜测是从1到9都是P帧
16-21是I帧
其余SPS PPS VPS SUFFIX_SEI_NUT

你可能感兴趣的:(播放器)