[Live-devel] H.264 NAL confusion

Mukherjee, Debargha debargha.mukherjee at hp.com
Thu Apr 2 10:01:50 PDT 2009


Hi Jeremy,

I am currently trying to attack a similar problem with the ffmpeg encoder (which I believe also uses X264). While I am not an expert on live either, from reading the archives this is what I have understood so far, and this is what I would try next. You need to send NAL units to your H264VideoRTPSink. Is the X264 encoder you are using creating a single NAL unit per video frame encoded? If not, you need to parse the bit-stream that you get from your encoder, extract NAL units and send them one by one to your sink. You may check for NAL units by checking for a 3 byte start code 0x000001, and then your NAL unit would begin from the next byte - until the next 0x000001 is encountered. Am not sure if this mechanism would work, but is worth a try. If there are multiple NAL units in a frame, you should probably set an internal parameter say currentNALUnitEndsAccessUnit_var to be TRUE only for the last NAL unit in the frame and FALSE for the others. Your currentNALUnitEndsAccessUnit() function should just return this variable currentNALUnitEndsAccessUnit_var. I would also set the fDurationInMicrosecs parameter to be 0 for all NAL units sent to sink except the last. For the last just use the actual duration of the frame. Also, I would make presentation time the same for all NAL units in the frame.

In order to write an x264VideoStreamFramer class, I would also model it based on the MPEG4VideoStreamDiscreteFramer class, and then add an appropriate parsing mechanism to extract NAL units from the encoded frame bit-stream received.

Best Regards,
Debargha.



________________________________
From: live-devel-bounces at ns.live555.com [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Jeremy Noring
Sent: Wednesday, April 01, 2009 6:53 PM
To: live-devel at ns.live555.com
Subject: Re: [Live-devel] H.264 NAL confusion

I'm still struggling to get this code to work correctly, and I'm sure I'm just doing something dumb (sorry, new to Live555 and H.264, and the available samples leave much to be desired).  I've attached the code I've written/used (some of it is stuff I found previous posters had used).

Once again, the video source is just a webcam.  The encoder is a directshow implementation of x264, and the framer is something I put together.  I think it's mostly likely that I'm doing something wrong in H264RTPSender.cpp, as this is the code I feel like I understand the least.

Any advice is hugely appreciated at this point; it's been two weeks and I'm still not able to get any video in VLC, quicktime, etc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090402/6be5e66a/attachment.html>


More information about the live-devel mailing list