我一直在使用PyAV和aiortc来设置一个使用webrtc的视频流。我想重新打包数据包并发送它们,而不进行代码转换。我遇到的问题是aiortc没有生成av_read_frame启动序列,之后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 starts指定的起始码(0x000001或0x00000001):https://stackoverflow.com/a/23516925/3442097
有人知道这里的错误是什么吗?
发布于 2019-08-02 22:21:08
MKV不使用annexb,而您正在使用的任何打包程序都使用。必须将尺寸转换为起始代码。
阅读此文;Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream
https://stackoverflow.com/questions/57323066
复制相似问题