[FFmpeg-devel] H.264 de-muxer replaces NALU units with sizes?

Stas Oskin stas.oskin
Sun Jan 16 11:58:47 CET 2011


Hi.

I've encountered a following interesting bit on Xuggle mailing lists:

When reading H264 encoded video in an FLV container, the muxer (ffmpeg
> in this case) strips all NALU initialization headers and replaces them
> with the size of the following information, in bytes.  There may be
> multiple instances of these in one packet. If you're reading to
> decode, it seems to work fine (I was able to use the video player
> demonstration code without a problem). If, on the other hand, you want
> to send the packet out again, you'll have to replace the "00 00 00 01"
> byte header.  It doesn't seem like any additional knowledge of NAL
> units are required, as the rest of the structure appears untouched.
>


This explains some trouble I had with re-streaming some H.264 RTSP streams,
particularly these with multiple NALU units.

Can anyone explain why FFMPEG alters the original packets (i presume some
info needed for decoding)?

Also, is there a place for flag/parameter for the packet read function,
which will cause it to preserve the original packet, in case only
re-streaming is required (and not decoding)?
This would save the operation of replacing the NALU by sizes which FFMPEG
does now, then replacing it again to "00 00 00 01" in user code to restore
back to original state.

Thanks.



More information about the ffmpeg-devel mailing list