简体   繁体   English

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

[英]No NAL start found in demuxed packet

I've been using PyAV and aiortc to set up a video stream using webrtc. 我一直在使用PyAV和aiortc使用webrtc设置视频流。 I want to repackage packets and send them without transcoding them. 我想重新包装数据包并发送而不进行代码转换。 The issue I'm having is that aiortc is that the av_read_frame call doesn't generate a NAL start sequence, after which aiortc fails when trying to find. 我遇到的问题是aiortc是av_read_frame调用不会生成NAL启动序列,此后aiortc在尝试查找时会失败。

I did a test, printing the first the beginning of each packer: 我做了一个测试,打印出每个包装机的开头:

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)

which yielded: 产生:

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' 

So it seems there is some sort of startcode, however not the one specified for NAL starts(0x000001 or 0x00000001): https://stackoverflow.com/a/23516925/3442097 因此似乎有某种起始码,但是没有为NAL启动指定的起始码(0x000001或0x00000001): https : //stackoverflow.com/a/23516925/3442097

Does anyone know what's at fault here? 有人知道这是怎么回事吗?

MKV does not use annexb, while whatever packerger you are using does. MKV不使用annexb,而您使用的任何打包程序都可以使用。 You must convert the sizes to start codes. 您必须将尺寸转换为起始代码。

Read this; 读这个; Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream H.264流的序列/图片参数集的可能位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM