[英]How to populate avcC box when encoding fmp4 file with H264 data?
my h264 frame just have I/P frame. 我的h264框架只有I / P框架。
The avcC box I filled in is as follows, but it cannot play with the VLC player (the timestamp runs but there is no image). 我填写的avcC框如下,但是它不能与VLC播放器一起播放(时间戳运行但没有图像)。
AVC Decoder Configuration Record : AVC解码器配置记录:
Start offset 511 (0X000001FF) 起始偏移量511(0X000001FF)
Box size 39 (0X00000027) 盒子大小39(0X00000027)
Box type avcC (0X61766343) 箱式AVCC(0X61766343)
Detailed-Information : 详细资料 :
Configuration version 1 (0X00000001) 配置版本1(0X00000001)
AVC profile indication Main = 77 (0X0000004D) AVC配置文件指示Main = 77(0X0000004D)
AVC profile compatibility 0 (0X00000000) AVC配置文件兼容性0(0X00000000)
AVC level indication 42 (0X0000002A) AVC等级指示42(0X0000002A)
NAL Unit length size 3 (0X00000003) NAL单位长度大小3(0X00000003)
Num sequence parameter sets 1 (0X00000001) 数值序列参数集1(0X00000001)
Sequence parameter set (0) 0x67 0x4d 0x00 0x2a 0x96 0x35 0xc0 0xf0 0x04 0x4f 0xcb 0x37 0x01 0x01 0x01 0x02 序列参数集(0)0x67 0x4d 0x00 0x2a 0x96 0x35 0xc0 0xf0 0x04 0x4f 0xcb 0x37 0x01 0x01 0x01 0x02
Num picture parameter sets 1 (0X00000001) 图片编号参数集1(0X00000001)
Picture parameter set (0) 0x68 0xee 0x3c 0x80 图片参数集(0)0x68 0xee 0x3c 0x80
H264 IDR FRAME( SPS PPS SEI): H264 IDR框架(SPS PPS SEI):
unsigned char IDR_NALU[] = { 0x00,0x00,0x00,0x01, 0x67,0x4D,0x00,0x2A, 0x96,0x35,0xC0,0xF0, 0x04,0x4F,0xCB,0x37, 0x01,0x01,0x01,0x02, 0x00,0x00,0x00,0x01, 0x68,0xEE,0x3C,0x80, 0x00,0x00,0x00,0x01, 0x06,0xE5,0x01,0x2E, 0x80/ I frame data is omitted / }; 无符号字符IDR_NALU [] = {0x00,0x00,0x00,0x01,0x67,0x4D,0x00,0x2A,0x96,0x35,0xC0,0xF0,0x04,0x4F,0xCB,0x37,0x01,0x01,0x01,0x02,0 ,0x00,0x01,0x68,0xEE,0x3C,0x80,0x00,0x00,0x00,0x01,0x06,0xE5,0x01,0x2E,0x80 / 省略I帧数据 /};
I think my avcC box is wrongly filled, but I don't know how to fill it correctly. 我认为我的avcC框被错误地填充,但是我不知道如何正确填充它。 Which master can help me 哪个大师可以帮助我
Here is some pseudo code on how to write the content of the avcC box: 这是一些有关如何编写avcC框内容的伪代码:
// Version
Write(0x1);
// Profile
Write(sps[0].data[1]);
// Compatibility
Write(sps[0].data[2]);
// level
Write(sps[0].data[3]);
// Reserved (6 bits), NAL Unit length size - 1 (2 bits)
Write(0xFC | 3);
// Reserved (3 bits), num of SPS (5 bits)
Write(0xE0 | 1);
// 2 bytes for length of SPS
WriteWord(sps[0].size);
// Data of SPS
for (size_t i = 0; i < sps[0].size(); ++i)
{
Write(sps[0].data[i]);
}
// Number of PPS
Write(&b, pps.size());
for (size_t i = 0; i < pps.size(); ++i)
{
// 2 bytes for length of PPS
WriteWord(pps[i].size);
for (size_t j = 0; j < pps[i].size; ++j)
{
// Data of PPS
Write (pps[i].data[j]);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.