【问题标题】:How to understand header of H.265如何理解 H.265 的标头
【发布时间】:2022-08-19 18:13:36
【问题描述】:

有人可以解释一下 H.264 标头和 H.265 标头之间的区别吗?我只需要解析 H265 标头,但我很难找到合适的参考。

我做了第一个版本的解析器。我需要检索 pic_width_in_luma_samples、pic_height_in_luma_samples 和 aspectRatioH、aspectRatioV。

我的代码是这样的:

    while (buf->Size > 0) // keep looping until we are done
            {
                flushbits(buf, 1); //forbidden bit
    
                int nNALType = showbits(buf, 6);
    
                if (nNALType == NAL_TYPE_SPS)
                {
                    flushbits(buf, 4); //sps_video_parameter_set_id
    
    // flushbits until I retrieve desired parameter
    }
    else
    {
    buf->Size     -=buf->BitsLeft & 0x7; //align bits
    }

}

这是正确的做法吗?有一种方法可以让我跳过位,直到找到指示我想要的 SPS NAL 类型的“开始序列”?

  • 您可能想稍微扩展一下问题,并可能包含您的一些代码。我猜 - 如果您在谈论“标题”,您指的是图片参数集(包含有关视频的数据)。 H.264/5 也有切片标头(包含有关以下切片/帧的数据)

标签: h.264 h.265


【解决方案1】:

H.264 和 H.265 的语法相对相似。

两者都有参数集(PPS、SPS),您可以在下面的规范中找到详细信息。 对于 H.265 - 第 33 页,第 7.3 节详细描述了视频参数集。 规范是用类似伪代码的“C”语言完成的,因此将规范翻译成编译代码相对容易。

您可以随时查看一些现有代码 - 例如:

https://github.com/GStreamer/gstreamer/blob/main/subprojects/gst-plugins-bad/gst-libs/gst/codecparsers/gsth265parser.c

H.264 (AVC) 规范在这里:

https://www.itu.int/rec/T-REC-H.264-202108-I/en

H.265 (HEVC) 规范在这里:

https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201802-S!!PDF-E&type=items

【讨论】:

  • 我做了第一个版本的解析器。我需要检索 pic_width_in_luma_samples、pic_height_in_luma_samples 和 aspectRatioH、aspectRatioV。
猜你喜欢
  • 2015-07-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-21
  • 2020-10-05
  • 1970-01-01
相关资源
最近更新 更多