首页 > 解决方案 > H264 SPS 和 PPS - 如果我更改它们会怎样?

问题描述

播放 H264 格式。

想知道如何构建具有所需 SPS 和 PPS 的视频吗?可能只是样本,1帧左右?我希望我使用了正确的术语。

有没有任何库?要创建具有所需 SPS 和 PPS 的视频?

以下是示例视频中的数据:

0x01 is the configurationVersion 

0x42 is AVCProfileIndication

0x00 is profile_compatibility

0x1F is AVCLevelIndication

0xFF is 6bit reserved and 2bit lengthSizeMinusOne

0xE1 is 3bit reserved and 5bit numOfSequenceParameterSets

0x00 0x09 is the length of sps is 9 bytes.

So the content of SPS is the next 9 bytes: 67 42 00 1f e9 02 c1 2c 80 

Next: 01 is numOfPictureParameterSets

0x00 and 0x04 are pps with a length of 4 bytes.

So the content of PPS is the next 4 bytes: 68 ce 06 f2 

The SPS length is: 9
The content of the SPS is: 67 42 00 1f e9 02 c1 2c 80 
----------
The PPS length is: 4
The content of the PPS is: 68 ce 06 f2 
----------

我的问题是如果我在视频文件中更改/修改 SPS 或 PPS 参数会发生什么?它仍然有效吗?那些似乎没有校验和?

例如,如果我更改 SPS 或 PPS 的长度?

标签: videoh.264

解决方案


SPS/PPS 对解码器需要的数据进行编码。它对分辨率、压缩方法、颜色数据等内容进行编码。每个视频只需要一次而不是每帧一次。如果修改它,解码器将无法正确解码视频,导致损坏或无输出。

它仍然有效吗?

好吧,这取决于您对“有效”的定义。如果它仍然设法确认规范,是的,但实际上不是。进行符合要求的随机更改的几率非常低。

即使不符合要求,许多解码器仍会尝试解码视频。但它很可能会失败。

我建议您获取 ISO-14496-10 的副本并阅读它,而不是随意更改。然后,您将了解您的更改实际上会做什么。


推荐阅读