[FFmpeg-trac] #5023(avformat:reopened): Can no longer read mjpeg from Mobotix camera

FFmpeg trac at avcodec.org
Fri Nov 16 15:31:41 EET 2018

#5023: Can no longer read mjpeg from Mobotix camera
             Reporter:  hackeron     |                    Owner:
                 Type:  defect       |                   Status:  reopened
             Priority:  important    |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  mjpeg        |               Blocked By:
  mpjpeg regression                  |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  0            |

Comment (by smbz):

 This is still an issue with the latest from git (d6b1248...), though with
 an Arecont Vision rather than Mobotix camera.  The problem occurs in
 mpjpeg_read_packet() at the avio_seek() call when locating the boundary

             do {
                 if (!memcmp(start, mpjpeg->searchstr,
 mpjpeg->searchstr_len)) {
                     // got the boundary! rewind the stream
                     avio_seek(s->pb, -len, SEEK_CUR);       // Silently
 fails, does not affect stream state
                     pkt->size -= len;
                     return pkt->size;
             } while (len >= mpjpeg->searchstr_len);

 At the point when avio_seek() is called, there is not enough data in the
 buffer to seek back by the correct amount, so the call fails.

 There is a call to ffio_ensure_seekback() which looks like it's meant to
 ensure that it is always possible to seek back by this amount, but from
 what I can tell this will work only at the beginning of the stream (i.e.
 for probing or headers) and not mid-stream.  Is anyone able to confirm

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

More information about the FFmpeg-trac mailing list