Ticket #401 (closed defect: fixed)

Opened 21 months ago

Last modified 14 months ago

ffmpeg fails to decode MJPG in AVI

Reported by: rectalogic Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mjpeg avi
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

ffmpeg fails to decode MJPG in AVI, sample is at  http://www.box.net/shared/fqqufn3ul5dlkheyu40r
mplayer successfully decodes and plays this sample.

$ ./ffmpeg -i /storage/test/mencoder/mjpg.avi -vcodec rawvideo -pix_fmt uyvy422 -vtag yuvs -an -f mov -y /tmp/o.mov
ffmpeg version N-31890-gecaf514, Copyright (c) 2000-2011 the FFmpeg developers  built on Aug 16 2011 14:34:59 with gcc 4.4.3
  configuration: --enable-debug=gdb3 --disable-optimizations --disable-asm --disable-stripping
  libavutil    51. 12. 0 / 51. 12. 0
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  7. 0 / 53.  7. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 31. 1 /  2. 31. 1
  libswscale    2.  0. 0 /  2.  0. 0
[avi @ 0x239c350] max_analyze_duration 5000000 reached at 5000000
Input #0, avi, from '/storage/test/mencoder/mjpg.avi':
  Duration: 00:06:07.93, start: 0.000000, bitrate: 227 kb/s
    Stream #0.0: Video: mjpeg, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s
[buffer @ 0x239d4b0] Invalid pixel format string '-1'
Error opening filters!

Change History

comment:1 Changed 21 months ago by cehoyos

  • Keywords mjpeg added
  • Status changed from new to open
  • Version changed from unspecified to git-master
  • Reproduced by developer set

Works fine with -analyzeduration 28000000

comment:2 follow-up: ↓ 5 Changed 21 months ago by reimar

This is probably caused by libavfilter. The (vsrc)buffer filter seems to need a pixfmt from the start.
However the filters are created before the decoder is actually opened.
So it is completely reliant on the probe filling in the pix_fmt.
However since this file is non-interleaved and FFmpeg detects this too late, the probe never gets any video data, thus does not open the decoder and thus the pix_fmt is not filled in.
This seems all rather silly though: it is quite silly that it is not tried to open the decoder during probe even if no data is available, as is opening the decoder only after the filter has been set up.

comment:3 Changed 21 months ago by janKG

I'm having the same problem, is there any progress on this ticket yet or any known workaround?

comment:5 in reply to: ↑ 2 Changed 21 months ago by michael

Replying to reimar:

This is probably caused by libavfilter. The (vsrc)buffer filter seems to need a pixfmt from the start.
However the filters are created before the decoder is actually opened.
So it is completely reliant on the probe filling in the pix_fmt.
However since this file is non-interleaved and FFmpeg detects this too late, the probe never gets any video data, thus does not open the decoder and thus the pix_fmt is not filled in.
This seems all rather silly though: it is quite silly that it is not tried to open the decoder during probe even if no data is available, as is opening the decoder only after the filter has been set up.

The decoder is opened in av_find_stream_info() but mjpeg can store a wide varity of pixel formats and iam not sure if the actually used one can be identified before the first frame.

comment:6 Changed 14 months ago by michael

  • Keywords avi added
  • Resolution set to fixed
  • Status changed from open to closed
  • Component changed from avcodec to avformat
Note: See TracTickets for help on using tickets.