标签:拷贝 form buffer rect pack idc unsigned tco emc
场景描述手动添加SPS/PPS信息到AVFormatContext
unsigned char sps_pps[] = { 0x00 ,0x00 ,0x01,0x67,0x42,0x00 ,0x2a ,0x96 ,0x35 ,0x40 ,0xf0 ,0x04 ,0x4f ,0xcb ,0x37 ,0x01 ,0x01 ,0x01 ,0x40 ,0x00 ,0x01 ,0xc2 ,0x00 ,0x00 ,0x57 ,0xe4 ,0x01 ,0x00 ,0x00 ,0x00 ,0x01 ,0x68 ,0xce ,0x3c ,0x80, 0x00};
pFormatContext->streams[0]->codecpar->extradata_size = sizeof(sps_pps);
pFormatContext->streams[0]->codecpar->extradata = (uint8_t*)av_mallocz(pFormatContext->streams[0]->codecpar->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
memcpy(pFormatContext->streams[0]->codecpar->extradata, sps_pps, sizeof(sps_pps));
通过avcodec_parameters_to_context将信息从pFormatContext->streams[0]->codecpar拷贝到m_pAVCodecContext
av_read_frame(pVideo->m_pAVFormatContext)分帧
avcodec_send_packet(m_pAVCodecContext)解码
出错异常如下
I:2018-01-06 14:26:03 ms:366:deprecated pixel format used, make sure you did set range correctly
I:2018-01-06 14:26:03 ms:387:unknown SEI type 229
I:2018-01-06 14:26:03 ms:387:unknown SEI type 128
I:2018-01-06 14:26:03 ms:390:nal_unit_type: 7, nal_ref_idc: 3
I:2018-01-06 14:26:03 ms:391:nal_unit_type: 8, nal_ref_idc: 3
I:2018-01-06 14:26:03 ms:392:nal_unit_type: 6, nal_ref_idc: 0
I:2018-01-06 14:26:03 ms:393:nal_unit_type: 5, nal_ref_idc: 3
I:2018-01-06 14:26:03 ms:393:unknown SEI type 229
I:2018-01-06 14:26:03 ms:393:Reinit context to 1920x1088, pix_fmt: yuvj420p
标签:拷贝 form buffer rect pack idc unsigned tco emc
原文地址:http://blog.51cto.com/fengyuzaitu/2058138