[Live-devel] H.264 Details

Mike Gilorma mike.gilorma at apogeelabs.com
Wed Jun 25 14:25:42 PDT 2008


thanks Jerry!

that's some great info that will probably come in handy once I get my
framer all ironed out!

On Tue, 2008-06-24 at 13:06 -0700, Jerry Johns wrote:
> Since there seems to be quite a few ppl writing H.264 frame
> subclasses, I think i'll give a gist of what I learned when i was
> creating one;
> 
> Basically, my stream was 0x00 00 00 01 delimited single NAL unit
> entities - the first NAL was my SPS, then PPS and then picture slices
> after that.
> 
> In your framer, after the delimiter, you read 1 byte, which is
> contains basic info about the NAL unit - once you have this byte, you
> parse it:
> 
>  
> 
> NAL_nri = (readChar >> 5) & 0x3;
> 
> NAL_type = readChar & 0x1F;
> 
> NAL_forbidden = readChar & 0x80;          
> 
>  
> 
> Now, if your NAL unit size is less than ethernet MTU (~1400 bytes),
> then you can go ahead and do single-NAL unit mode in which case you
> drop the 4 byte delimiter, and pass this to liveMedia to send
> 
>  
> 
> If it is > 1400 byte (most of the time they are), then you'll have to
> do FU-A mode; FU-A mode specially requires an indicator and a header.
> 
>  
> 
> FU_indicator = (NAL_forbidden << 7) | (NAL_nri << 5) | (28); //28 is
> FU-A type
> 
> FU_header = (NAL_type) | (FUA_START);  //FUA_START is 1<<7
> 
>  
> 
> This indicator goes first, then the header, and then you append your
> NAL unit data - NOTE however, that the NAL unit data you append should
> not have the delimiter AND the 1 byte NAL info present.
> 
>  
> 
> After this first transmission, you send successive FU-A packets with
> the remaining NAL unit data with the same FU_indicator, but a changed
> FU_header
> 
> if the current packet you're sending is not the last packet, then:
> 
>  
> 
> FU_header = (NAL_type);           //dont signal the end yet, as per
> RFC Spec                                  
> 
>  
> 
> if it is the last packet then:
> 
>  
> 
> FU_header = (NAL_type) | (FUA_END); //signal last frame of NAL unit,
> FUA_END = 1<<6
> 
>  
> 
> That's as easy as it gets to sending H.264 data to VLC and it should
> play it beautifully :)
> 
>  
> 
>  
> 
> Jerry Johns
> 
> Design Engineer
> 
> Nuvation Research Corp - Canada
> 
> Tel: (519) 746-2304 ext. 225
> 
> www.nuvation.com
> 
>  
> 
>  
> 
>  
> 
> 
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel




More information about the live-devel mailing list