[FFmpeg-trac] #4840(undetermined:new): MJPEG streaming issues

FFmpeg trac at avcodec.org
Thu Sep 10 05:43:28 CEST 2015


#4840: MJPEG streaming issues
--------------------------------------+----------------------------------
             Reporter:  w3sip         |                     Type:  defect
               Status:  new           |                 Priority:  normal
            Component:  undetermined  |                  Version:  2.7
             Keywords:                |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+----------------------------------
 Symptom:
 - mpjpeg demux is not selected, resulting in multipart MIME headers to be
 read as part of the frame
 - when selected, it fails to parse the headers in some cases
 - when it provides a jpg frame, the frame fails to be decoded

 Scenario:
 - test environment consists of ffserver serving 2 jpg files over HTTP
 - client code reads the input via HTTP URI and reads compressed frames
 using av_read_frame (no decoding is performed at that stage)
 - frame data is passed further down the pipeline, where it is decoded
 using avcodec_decode_video2
 - version of the library used: 2.8

 My take on what is going on:
 1) When matching based on MIME type occurs in libavformat/format.c, two
 strings are compared literally. So, if MIME type is provided as
 'multipart/x-mixed-replace;boundary=ffserver', it will never match the
 'multipart/x-mixed-replace;boundary', which is part of MPJPEG demux
 configuration.
 2) Multipart header parsing will fail for a few reasons:
 - trailing/leading space within HTTP header will throw the parser off
 - empty line following the MIME headers will be parsed as a header, and
 cause a failure
 3) decoding seems to fail because of how EOI (d9) marker is handled. I
 have little knowledge of JPG structure, but the attached change makes a
 difference between failure and success. Doesn't make the change correct,
 but at least it pinpoints the cause.

 I'm attaching two files:
 1) Proposed patch -- if needed, can be submitted via pull request.
 2) x.jpg -- saved JPG frame which fails to decode

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4840>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list