[FFmpeg-user] Wired prefix in h264 NAL

David Cassany Viladomat david.cassany at i2cat.net
Tue Jun 18 19:10:52 CEST 2013


Dear all,

We are trying to recieve, decode and play an h264 rtp stream and we are
facing a wired behavior in avcodec_decode_video2 function. It seams that
the source data persent in AV_PACKET must contain 0x001bytes as the first
values in h264 NAL.

In file libavcodec/h264.c we see the follwing code:

for (; buf_index + 3 < next_avc; buf_index++)
       // This should always succeed in the first iteration.
       if (buf[buf_index]     == 0 &&
             buf[buf_index + 1] == 0 &&
             buf[buf_index + 2] == 1)
         break;


So that we add this prefix (0x001) in every NAL prior to build the
av_packet. But obviously there's something wrong, as we can't decode any
single frame.

Does anyone have a clue on what it migth happen here?

Sorry if I am not clear enough... Thanks in advance,

David


More information about the ffmpeg-user mailing list