gpt4 book ai didi

video-streaming - H264 NAL 单元前缀

转载 作者:行者123 更新时间:2023-12-04 23:50:28 27 4
gpt4 key购买 nike

我需要对 H264 NAL 单元分隔符前缀( 00 00 00 0100 00 01 )进行一些说明,我正在使用 Intel Media SDK 生成 H264 并将其打包到 RTP 中。问题是到目前为止我只在寻找 00 00 00 01作为单位分隔符,基本上只能在比特流中找到 AUD、SPS、PPS 和 SEI 单位。查看内存我看到在SEI之后有一个字节序列00 00 01 25这可能是 IDR 单元的开始,但由于缺少零字节,我的搜索算法没有检测到它。谁能澄清 00 00 00 01 之间的区别和 00 00 01前缀?看着 Chromium code似乎第一个单位以及 AUD、SPS、PPS 和 SEI 有一个额外的零:

if (first_nal_in_this_access_unit ||
IsAccessUnitBoundaryNal(nal_unit_type)) {
output_size += 1; // Extra zero_byte for these nal units
first_nal_in_this_access_unit = false;
}

...

static bool IsAccessUnitBoundaryNal(int nal_unit_type) {
// Check if this packet marks access unit boundary by checking the
// packet type.
if (nal_unit_type == 6 || // Supplemental enhancement information
nal_unit_type == 7 || // Picture parameter set
nal_unit_type == 8 || // Sequence parameter set
nal_unit_type == 9 || // Access unit delimiter
(nal_unit_type >= 14 && nal_unit_type <= 18)) { // Reserved types
return true;
}
return false;
}

1)我假设我应该查找两个前缀,但后来我明白我需要检查下一个 NAL 单元的类型才能知道当前单元的长度(要知道前缀是 3 还是 4 个字节并且不消耗可能作为前一个 NAL 单元结尾的零字节作为前缀)。

2) PPS、SPS 和 SEI 大小是否固定?如果是这样,我可以在寻找下一个前缀时跳到单元的末尾。

我希望对此有更多经验的人可以对上述问题发表评论。

最佳答案

来自 H.264 spec ,B.1.2字节流NAL单元语义:

enter image description here

zero_byte is a single byte equal to 0x00.

When any of the following conditions are fulfilled, the zero_byte syntax element shall be present.

  • the nal_unit_type within the nal_unit( ) is equal to 7 (sequence parameter set) or 8 (picture parameter set)
  • the byte stream NAL unit syntax structure contains the first NAL unit of an access unit in decoding order, as specified by subclause 7.4.1.2.3.

关于video-streaming - H264 NAL 单元前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23516805/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com