FFmpeg extradata问题描述

时间:2018-01-06 16:36:17   收藏:0   阅读:1446
场景描述

            手动添加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

原文:http://blog.51cto.com/fengyuzaitu/2058138

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!