[Libav-user] Split encoded x264 frame into nal units?

Christian Brümmer christian.bruemmer at gmx.de
Sun Jun 17 13:01:02 CEST 2012


Am 16.06.2012 01:10, schrieb Christian Brümmer:
>
> Hi!
>
> I'm using Live555 for RTSP streaming but i need to pass single nal units
> to the sink. I know a ffmpeg x264 frame may consists of several nal
> units. How can i split the payload into the nals?
>
> Another question: each frame begins with the h264 start code - i have to
> get rid of it before parsing to the live555 sink. How can i cut off the
> start code from the payload? It is always the first 4 bytes?
>
> Best regards,
> Christian
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
I figured out that a nal unit (annex b) starts with the startcode 
0x00000001 or 0x000001 (depends on the encoder implementation). the size 
of a nal unit isnt known but you can search for the next startcode and 
the bytes between are the nal unit.
anyway with my encoding configuration i never get more than one 
startcode at the beginning of a encoded frame. cutting the first 4 bytes 
off is working for me so far!


More information about the Libav-user mailing list