[Ffmpeg-devel] RTP patches & RFC

Derk-Jan Hartman hartman
Thu Oct 12 20:42:49 CEST 2006

On 12-okt-2006, at 15:59, Ryan Martell wrote:
> The other part of the issue is that the rtp stuff wouldn't start  
> until the extradata for the codec was filled in; the only way to  
> fill it in (I thought) was giving it a valid AvC block, which is  
> why I ended up going down that path.  I'll reinvestigate.

if you use avcC in the extradata, libavcodec expects lengthsize  
header prepended nalunits. But if you use startcodes, the extradata  
needs to use those as well.

Take the SPS/PPS from the SDP and prepend them with 4 byte startcodes  
( 0 0 0 1 ) and put them in the extradata. SPS's before the PPS's.  
Then use startcodes in the bitstream, and it should be just fine.

The level info is information you don't need to pass, since they are  
actually byte 1,2,3 from the SPS (starting from byte 0). The  
lengthsize is not required because you use startcodes.

IDR/SPS/PPS nals require 0 0 0 1 as startcode, all the other nals  
require 0 0 1. Note that an arbitrary number of 0's prepended to the  
startcodes is allowed. In theory you can prepend 0 0 0 1 for all  
nals, but it's not known how well the other h264 products handle that.


More information about the ffmpeg-devel mailing list