[FFmpeg-devel] MJPEG bug

Aaron Miller amiller at atlasdigital.tv
Mon Oct 3 08:56:44 CEST 2011


Michael,

Here is one problem frame from the (large) raw MJPEG stream I have.

And thanks for the tip about mjpeg_parser.c! I believe that's what I need to
change.

Aaron



On Sun, Oct 2, 2011 at 11:15 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Sun, Oct 02, 2011 at 08:40:20PM -0700, Aaron Miller wrote:
> > Hello all,
> >
> > I am currently working on fixing an apparent bug in FFmpeg's Motion-JPEG
> > (mjpeg) codec. I have determined that the codec is looking for JPEG
> markers
> > (0xFF <marker byte>) in the marker payloads.  Occasionally, the two bytes
> > 0xFF 0xD8 will happen to occur inside the quantization table for some
> > frames, and FFmpeg will treat this as the end of the frame and the start
> of
> > the next one, since it is interpreted as the SOI (start of image) marker.
> > 0xFF bytes in marker payloads are not escaped, and so this codec needs
> some
> > way to skip over marker payloads when looking for markers.  The error
> > message that results from this is:
> >
> >    [mjpeg @ 0x13f4a60] No JPEG data found in image
> >
> > I have been trying to implement this by modifying three functions in
> > mjpegdec.c (ff_mjpeg_decode_frame, ff_mjpeg_find_marker, and find_marker)
> to
> > handle the marker payloads correctly, but it seems that other code needs
> to
> > be fixed too.  For one problem frame, the buffer in the avpkt structure
> > which is passed to ff_mjpeg_decode_frame is just 139 bytes in size, since
> > apparently some other code is looking for JPEG markers and truncating or
> not
> > reading the full buffer.  Where might this code be? Where is the avpkt
> > produced from the file data?
>
> please provide a sample mjpeg or url of one that fails
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I do not agree with what you have to say, but I'll defend to the death your
> right to say it. -- Voltaire
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0058.jpg
Type: image/jpeg
Size: 20780 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111002/948cfd26/attachment.jpg>


More information about the ffmpeg-devel mailing list