将NAL头添加到原始H264流 [英] Adding NAL headers to raw H264 stream

查看:527
本文介绍了将NAL头添加到原始H264流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了将NAL头添加到原始H264流中,我需要做什么?最终,我想拍摄视频文件并将其与音频文件复合。



2相关问题:

1。)我看过这篇文章: H. 264转换与FFmpeg(从RTP流)



然而,当我看每帧的前两个字节,我看到0和0对于我录制的任何画面,我们都没有提及任何关于NAL内容的内容。



我在正确的地方看吗?是否还有另一种方法可以在NAL头文件中创建和写入H264流?



2。)另外,NAl头是否包含任何时间信息?我怎样才能将它与音频同步?



谢谢!

解决方案

当你说NAL头文件时,我不知道你的意思。但是,您的信息流很可能是附件格式。在AnnexB格式中,每个NALU都有一个起始码。通常它是一个3(0x000001)或4(0x00000001)字节的起始码。只需跳过这些字节即可。


In order to add NAL headers to a raw H264 stream, what do I need to do? Ultimately, I want to take the video file and mux it with an audio file.

2 related questions:

1.) I've looked at this post: H.264 conversion with FFmpeg (from a RTP stream)

However, when I look at the first two bytes of each frame, I'm seeing 0 and 0 for any frame I record, which doesn't say anything about the NAL contents.

Am I looking at the right place? Is there another way I can create and write in NAL headers to a H264 stream?

2.) Also, does the NAl header contain any timing information? How could I sync it with the audio?

Thanks!

解决方案

I have no idea what you mean when you say NAL headers. However, your stream is most likely in annexb format. In annexB format each NALU is preceded with a start code. Usually it is a 3 (0x000001) or 4 (0x00000001) byte startcode. Simply skip past these bytes.

这篇关于将NAL头添加到原始H264流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆