How to fragment H264 Packets in RTP compliant with RFC3984

不打扰是莪最后的温柔 提交于 2019-11-30 05:10:20

As an author to RFC 3984bis (to be RFC 6184), it details exactly how to convert H.264 NALs into RFC 3984 packets. There are 3 modes: 0 (single-NAL), 1 (allows for fragmenting and combining NALs), and 2 (lets you fragment, combine, and interleave the transmission order to change how a burst loss will affect a stream, among other things). See SDP packetization-mode. Only mode 0 is required.

Mode 0 (Single-NAL) requires you either use UDP fragmentation (discouraged) or tell the encoder don't generate NALs larger than MTU-X. You should be able to tell the encoder this.

Mode 1 lets you fragment. See the RFC for how you set up an FU-A packet. The fragmentation info is on the front. You can also use STAPs to aggregate small NALs like SPS and PPS packets sent before IDRs (normally). Each packet requires normal RTP headers with incremented sequence numbers (but the same timestamp).

Mark on the last RTP packet of a frame (not of a fragment or NAL) is expected but you shouldn't count on it.

In x264, I believe the int i_slice_max_size in x264_param_t can be used to control the size. Have a look in x264.h I can't remember where I read this, but the post said this structure member can be used to control the NAL size, but I haven't tried it myself.

int i_slice_max_size; /* Max size per slice in bytes; includes estimated NAL overhead. */

EDIT: I found the source

http://mailman.videolan.org/pipermail/x264-devel/2011-February/008263.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!