Monday, March 5, 2012

RTP Packetization for H.264 NAL Units

H.264 Network Abstract Layer Header
How to Broadcast Multimedia Contents?

RFC3984 (RTP Payload Format for H.264 Video) defines 3 modes: 0 (single NAL unit mode), 1 (non-interleaved mode), and 2 (interleaved mode).  Mode 0 requires you either use UDP fragmentation or tell the encoder not to generate NALs larger than MTU-X. Mode 1 lets you do fragmentation. Details of how to set up a fragmentation unit packet can be found in the RFC. Basically the fragmentation information is on the front. Small NAL units, e.g. SPS and PPS packets, can be aggregated together using single-time aggregation packets (STAPs). Each packet requires normal RTP headers with incremented sequence numbers but the same timestamp. Though a mark on the last RTP packet of a frame is expected,  it is not guaranteed. Mode 2 lets you fragment, combine, and interleave the transmission order to change how a burst loss will affect a stream, among other things.

No comments: