gpt4 book ai didi

python - 在解复用的数据包中找不到 NAL 开始

转载 作者:行者123 更新时间:2023-12-04 23:07:58 26 4
gpt4 key购买 nike

我一直在使用 PyAV 和 aiortc 使用 webrtc 设置视频流。
我想重新打包数据包并发送它们而不进行转码。我遇到的问题是 aiortc 是 av_read_frame 调用不会生成 NAL 启动序列,之后 aiortc 在尝试查找时失败。

我做了一个测试,打印每个打包机的第一个开头:

import av
container = av.open(file="jellyfish.mkv", format="matroska", mode="r")
video_stream = [x for x in container.streams if x.type == "video"]

for i in range(4):
packet = next(container.demux(video_stream))
s = bytes(packet)[0:8]
print(s)

这产生了:
b'\x00\x00\xb5\xbae\x88\x80@'
b'\x00\x00A:A\x9a\x02\r'
b'\x00\x00\x18\xe2\x01\x9e\x04\x05'
b'\x00\x00\x19E\x01\x9e\x04\t'

所以似乎有某种起始码,但不是为 NAL 指定的起始码(0x000001 或 0x00000001): https://stackoverflow.com/a/23516925/3442097

有谁知道这里有什么问题?

最佳答案

MKV 不使用附件b,而您使用的任何打包程序都可以。您必须将尺寸转换为起始代码。

读这个; Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream

关于python - 在解复用的数据包中找不到 NAL 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57323066/

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