[Live-devel] H.264 NAL confusion

Ross Finlayson finlayson at live555.com
Thu Mar 19 23:30:46 PDT 2009


>My question is: do I need to package this according to RFC 3984?

No.  Our software (in particular, the "H264VideoRTPSink" class) 
already implements the RTP payload format described in  RFC 3984. 
All you need to do is deliver - one at a time - NAL units to it 
(*without* a preceding 'length' field).


>   Also, do I need to break it up (my NAL units are decidedly larger 
>than 1400 bytes...)

No - we do this all for you.


>One final (unrelated) question: I'm confused about 
>fPresentationTime.  What are the units of this value?  Is it an 
>absolute time or a relative time, and do I need to set any "base" 
>times or anything like that?  I get timestamps from my encoder, but 
>I'm not sure how they relate to fPresentationTime.

"fPresentationTime" should be aligned with 'wall clock' time - i.e., 
the time that you get by calling "gettimeofday()".  Because your 
incoming NAL units have their own timestamps, I suggest that you set 
"fPresentationTime" - for each NAL unit - as follows:

	struct timeval presentationTimeBase;
	Boolean isFirstNALUnit = True;

	if (isFirstNALUnit) {
		struct timeval timeNow;
		gettimeofday(&timeNow, NULL);
		presentationTimeBase = timeNow - theCurrentNALUnitsTimestamp;
		isFirstNALUnit = False;
	}
	fPresentationTime = presentationTimeBase + theCurrentNALUnitsTimestamp;
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list