简体   繁体   English

解码H.264单个最终单位

[英]Decoding H.264 individual nal units

I am currently sending individual NAL units across a network. 我目前正在通过网络发送单个NAL单元。 These NAL units are generated by x264. 这些NAL单元由x264生成。 Now is it possible to feed these NAL units individually into avcodec_decode_video2? 现在可以将这些NAL单元分别输入avcodec_decode_video2吗?

Or do I have to concatenate the nal units until they represent the same frame? 还是我必须串联这些最终单位,直到它们代表相同的框架? If thats the case then how is that done? 如果是这样,那怎么办?

I have also read that I might be able to receive the SPS and PPS packets. 我还读到我可能能够接收SPS和PPS数据包。 Then wait for at least one packet, and attempt to decode. 然后等待至少一个数据包,然后尝试解码。 Is this correct? 这个对吗?

Any advice that can be offered would be greatly appreciated 可以提供的任何建议将不胜感激

Yes, it is possible for us to pass the NAL units individually to the decoder. 是的,我们可以将NAL单元分别传递给解码器。 H264 has the capability to split into multiple slices with multiple NAL units per frame. H264具有将每个帧分成多个带有NAL单元的多个片的功能。 Pl. Pl。 refer to the tutorial which provides steps to decode using ffmpeg. 请参阅该教程,该教程提供了使用ffmpeg进行解码的步骤。 http://dranger.com/ffmpeg/tutorial01.html . http://dranger.com/ffmpeg/tutorial01.html

Also check the output of the av_read_frame call to understand how the frame data is coming. 还要检查av_read_frame调用的输出,以了解帧数据的输出方式。 Suggest you pl. 建议你。 refer to the below stack overflow link which also explains the issue with NAL decoding H264: decode series of nal units with ffmpeg 请参考下面的堆栈溢出链接,该链接还解释了NAL解码H264的问题:使用ffmpeg解码nal单元序列

I had a similar issue - Setting the key_frame on the packet solved any NAL issues. 我有一个类似的问题-在数据包上设置key_frame解决了所有NAL问题。 Also make sure you set the extra data in the codec context. 还要确保您在编解码器上下文中设置了额外的数据。

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

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