[FFmpeg-trac] #3900(avformat:new): ff_check_h264_startcode does not support 3-byte startcodes

FFmpeg trac at avcodec.org
Thu Aug 28 13:29:25 CEST 2014

#3900: ff_check_h264_startcode does not support 3-byte startcodes
             Reporter:  Lastique  |                    Owner:
                 Type:  defect    |                   Status:  new
             Priority:  normal    |                Component:  avformat
              Version:  2.3       |               Resolution:
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |

Comment (by Lastique):

 Replying to [comment:3 cehoyos]:
 > Replying to [ticket:3900 Lastique]:
 > > The 3-byte startcode is produced by libx264 for SEI NAL. Our
 application uses libx264 and ffmpeg through C API and at some point passes
 an AVPacket that starts with SEI to av_interleaved_write_frame, which
 > This seems to describe a different failure than the one for which you
 uploaded a sample and provided a command line. Is the issue with using
 libx264 to encode and libavformat to mux not reproducible with
 {{{ffmpeg}}} (the application)?

 I don't use ffmpeg application in my case, so I can't tell. The test case
 I described simply illustrates the issue I'm having when using ffmpeg
 through C API. If you inspect the sample file you will notice that its
 first frame starts with a 3-byte startcode and a SEI NAL. I could create a
 C program to produce the same error, it's just more time consuming.

 > I tested your patch and the file you uploaded: The patch allows to write
 invalid transport streams with {{{ffmpeg -i ticket3900.avi​ -vcodec copy
 out.ts}}} which could be fixed by moving the changed function to
 libavformat/avienc.c but neither the original file nor the (with your
 patch) remuxed avi file play with WMP, so I suspect the error message is
 not wrong or do I miss something?

 As far as I understand, the 3-byte startcode is valid in h264 (see ITU-T
 H.264, Annex B; there is also a shorter description here:
 http://www.szatmary.org/blog/25), so ffmpeg should recognize and support
 it. This is not specific to avi or any other container since this is about
 the NAL bitstream format. If WMP doesn't support the 3-byte startcode then
 WMP is buggy. That said, it may be that WMP doesn't support the particular
 combination of the codec, bitstream parameters and container. I'm not
 really concerned with WMP.

Ticket URL: <https://trac.ffmpeg.org/ticket/3900#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list