简体   繁体   English

使用H264数据编码fmp4文件时如何填充avcC框?

[英]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.

相关问题 关于fmp4编码,如何填充mdat框和H264帧? - about fmp4 encoding , how to fill the mdat box wit H264 frame? fmp4文件如何根据AAC帧的ADTS填充esds框? - How does the fmp4 file populate the esds box according to the ADTS of the AAC frame? 关于fmp4文件第一个mdat框的问题 - A question about the first mdat box of the fmp4 file FFmpeg相机编码H264 MP4混合原子AVCC太小 - FFmpeg camera encode h264 mp4 muxing atom avcC is too small 哪盒fmp4文件包含的CTTS信息与普通MP4文件相似? - Which box of fmp4 file contains CTTS information similar to that of ordinary MP4 file? ffmpeg:如何将h264原始数据保存为mp4文件 - ffmpeg: how to save h264 raw data as mp4 file 如何在iOS中播放.h264文件(或)如何以编程方式将.h264文件转换为.mp4文件 - How to play a .h264 file in iOS (or) How to convert .h264 file in to .mp4 file programmatically 关于用于视频编码的最佳质量/性能H264编码器的建议? - Recommendation on the best quality/performance H264 encoder for video encoding? 如何从我从实时流媒体接收的H264原始数据创建Mp4文件 - How to create an Mp4 file from H264 raw data that I am receiving from a live streamer VLC播放器如何计算fmp4文件的时间轴总长度? - How does the VLC player calculate the total length of the timeline of the fmp4 file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM