Log in

View Full Version : X264 Locating NAL Unit


Rya
12th June 2006, 14:24
I'm trying to figure out the format of the NAL Units in X264. I added a printf command in the source:

int write_nalu_bsf( hnd_t handle, uint8_t *p_nalu, int i_size )
{

int n;

for(n=0; n < i_size; n++){
printf("%02X", p_nalu[n]);
}
printf("\n");

if (fwrite(p_nalu, i_size, 1, (FILE *)handle) > 0){
return i_size;
}
return -1;
}

However the hexadecimal output of one of the lines here will be:
00000001419AF97CB3FFE...

These first hexadecimal values seem to follow a certain rule, so I'm pretty sure they don't belong to the payload. However if I look at the definition of a NAL unit header, it says:
F - 1 bit
NRI - 2 bit
TYPE - 5 bit
Which would only be 8 bits i.e. only 2 hexadecimals.

Question is where can I find F, NRI and TYPE in the output and where does the payload start?

jel
13th June 2006, 04:41
hi Rya and welcome to the forum!

i will move this to the development forum where one of the gurus there should be able to point you in the right direction.

good luck
j

Rya
15th June 2006, 19:45
Hi there.

Nobody did reply yet, though.

Actually I think I only have to remove the "00000001" the 41 could probably be the NAL header. I'd like to get some confirmation, though.

(Note: I'm trying to implement streaming with RTP for X264)