[Live-devel] H.264 NAL confusion

Jeremy Noring kidjan at gmail.com
Thu Mar 19 22:21:42 PDT 2009


As an H.264 source, I'm using a DirectShow filter implementation of x264
which can be found here:

http://blog.monogram.sk/janos/2008/12/29/monogram-x264-encoder-1020/

...and here are some comments by the author of that x264 filter regarding
the output:

<< This filter delivers NAL units in the form as they are described in
ISO/IEC 14496-15 (AVC File Format). That means each NAL unit is superceeded
by 4-byte length and then the NAL unit follows (without the Annex B start
code). Most filters supporting H.264 do this the same way (Haali splitter,
ffdshow, …)

e.g.
00 00 00 37 | 45 … (another 0×36 bytes of IDR nal unit)

If more NAL units are delivered they look like this

<4byte SIZE>NAL<4byte SIZE>NAL

2) “00 00 00 01″ is not in there

3) When you skip the first 4 bytes you get the exact start of the NAL unit

4) PPS and SPS are encoded in the mediatype format structure AFTER the
VideoInfo or MPEG_VIDEO_INFO structures. They are encoded in this form

<2byte size>NAL<2byte size>NAL

This might look like this :

00 1B 67 42 C0 33 AB 40 5A 09 37 FE 00 20 00 1E 20 00 00 03 00 20 00 00 06
51 E3 06 54 00 04 68 CE 3C 80 >>
What I want to do is stream this video using Live555.  I've created a framer
that inherits from H264VideoStreamFramer.  I see that it does "stream"
something out over the network, but I can't get VLC to render it correctly.
I see that my NAL units come with a 4-byte header specifying the length of
the NAL unit.  Each of my NAL units appears to roughly correspond with a
single frame of video (i.e. one frame = one NAL unit, so the buffers are
sort of big).

My question is: do I need to package this according to RFC 3984?  Also, do I
need to break it up (my NAL units are decidedly larger than 1400 bytes...),
or can I count on the H264FUAFragmenter to do that for me?  I'm definitely
confused on how I need to format the output of my decoder.  If it helps, I
can definitely post some code snippets.

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.

Any advice is much appreciated; thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090319/0f017f93/attachment.html>


More information about the live-devel mailing list