Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3616 closed enhancement (fixed)

Mjpeg autodetection

Reported by: Đonny Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mjpeg
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
I have one strange MJPEG file. If the file is stored with .mjpeg extension ffprobe/ffplay works just fine. If the file has .avi extension it misdetects format as AVI and then refuses to play. If it has some random extension (or no extension at all) the file also cannot be played.
How to reproduce:
.mjpeg

D:\UgcTestFiles\Video>ffprobe MJPEG.mjpeg
ffprobe version N-62963-g656fe7e Copyright (c) 2007-2014 the FFmpeg developers
  built on May  4 2014 22:09:17 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 81.100 / 52. 81.100
  libavcodec     55. 60.103 / 55. 60.103
  libavformat    55. 37.102 / 55. 37.102
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mjpeg, from 'MJPEG.mjpeg':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, 25 fps, 25 tbr, 1200k tbn, 25 tbc

.xxx

D:\UgcTestFiles\Video>ffprobe MJPEG.xxx
ffprobe version N-62963-g656fe7e Copyright (c) 2007-2014 the FFmpeg developers
  built on May  4 2014 22:09:17 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 81.100 / 52. 81.100
  libavcodec     55. 60.103 / 55. 60.103
  libavformat    55. 37.102 / 55. 37.102
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
MJPEG.xxx: Invalid data found when processing input

.avi

D:\UgcTestFiles\Video>ffprobe MJPEG.avi
ffprobe version N-62963-g656fe7e Copyright (c) 2007-2014 the FFmpeg developers
  built on May  4 2014 22:09:17 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 81.100 / 52. 81.100
  libavcodec     55. 60.103 / 55. 60.103
  libavformat    55. 37.102 / 55. 37.102
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[avi @ 0000000002a44920] Format avi detected only with low score of 1, misdetection possible!
MJPEG.avi: Invalid data found when processing input

Change History (9)

comment:1 follow-up: Changed 5 years ago by Đonny

I cannot upload the file because of size limitations, please download it from http://docs.voanews.eu/en-US-TEST-LTR/2014/05/06/f35d1270-fa55-4f82-aefc-e3db136aa395.avi.

comment:2 in reply to: ↑ 1 ; follow-up: Changed 5 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords detection removed
  • Priority changed from normal to wish
  • Resolution set to duplicate
  • Status changed from new to closed
  • Summary changed from Mjpeg misdetection to Mjpeg autodetection
  • Type changed from defect to enhancement

Replying to Đonny:

I cannot upload the file because of size limitations

This sounds as if the problem is not reproducible with:

$ ffmpeg -f lavfi -i testsrc -t 10 -f mjpeg out.avi

Imo, this is a duplicate of ticket #2541.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 5 years ago by Đonny

Replying to cehoyos:

This sounds as if the problem is not reproducible with:

$ ffmpeg -f lavfi -i testsrc -t 10 -f mjpeg out.avi

The problem is not reproducible this way because you provide -f. But I cannot provide -f in my situation because I have no idea what the format of the input file is. I just have file with random extension but it can be anything from mp4 to ogv.

If I run my commands with -f e.g.

ffprobe -f mjpeg d:\temp\MJPEG.avi

or

ffprobe -f mjpeg d:\temp\MJPEG

(note: MJPEG.avi and MJPEG are the same files, just renamed, and they are actually MJPEG)
everything works perfectly.
The thing I'm complaining here about is that ffprobe/ffplay/ffmpeg does not detect MJPEG format correctly when file is without extension (or with random extension) and misdetects format as AVI when the extension is .avi.

Regarding ticket #2541 - I'm not sure if this is duplicate. I don't understand completely what #2541 is about.

comment:4 in reply to: ↑ 3 Changed 5 years ago by cehoyos

Replying to Đonny:

Replying to cehoyos:

This sounds as if the problem is not reproducible with:

$ ffmpeg -f lavfi -i testsrc -t 10 -f mjpeg out.avi

The problem is not reproducible this way

You used this command line to produce an output file out.avi and tested ffmpeg -i out.avi or your command line above with this file and it did not allow to reproduce the issue?

Regarding ticket #2541 - I'm not sure if this is duplicate. I don't understand completely what #2541 is about.

It is about autodetecting (m)jpeg (and other image codecs).

comment:5 follow-up: Changed 5 years ago by Đonny

I didn't use this command at all. The command cannot reproduce the issue I'm experiencing by it's nature IMO.
I was using the commands specified in bug description with results given in bug description. I was running them on the same file with different file name (different extension). The origin of the file is unknown for me - i.e. I didn't create it using ffmpeg.

Since #2541 is about autodetection of mjpeg, my issue is duplicate to it and we don't have to discuss it here further.

Thank you for your help!

comment:6 in reply to: ↑ 5 ; follow-up: Changed 5 years ago by cehoyos

Replying to Đonny:

I didn't use this command at all.

Too bad.

I was using the commands specified in bug description with results given in bug description. I was running them on the same file with different file name (different extension).

But don't you agree that it makes reading the ticket much easier if FFmpeg alone allows to reproduce a ticket instead of downloading a specific file?

The origin of the file is unknown for me - i.e. I didn't create it using ffmpeg.

But you could have created a file with FFmpeg that allows to reproduce the issue making the report significantly simpler.

comment:7 in reply to: ↑ 6 ; follow-up: Changed 5 years ago by Đonny

Replying to cehoyos:
Sorry, I originally didn't understand what was your command good for. Now I got it.
I can reproduce the error by running

ffmpeg -f lavfi -i testsrc -t 10 -f mjpeg d:\temp\xxxyyy.avi

and then running

ffplay d:\Temp\xxxyyy.avi

or

ffprobe d:\Temp\xxxyyy.avi

both give me error, though a little bit different then on my file

D:\Users\zarubaj>ffplay d:\Temp\xxxyyy.avi
ffplay version N-62283-ged96241 Copyright (c) 2003-2014 the FFmpeg developers
  built on Apr  8 2014 22:09:06 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 75.100 / 52. 75.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 36.102 / 55. 36.102
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
d:\Temp\xxxyyy.avi: Invalid data found when processing inputf=0/0
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

D:\Users\zarubaj>ffprobe d:\Temp\xxxyyy.avi
ffprobe version N-62283-ged96241 Copyright (c) 2007-2014 the FFmpeg developers
  built on Apr  8 2014 22:09:06 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 75.100 / 52. 75.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 36.102 / 55. 36.102
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
d:\Temp\xxxyyy.avi: Invalid data found when processing input

If I rename xxxyyy.avi to xxxyyy.mjpeg both - ffprobe and ffplay work

comment:8 in reply to: ↑ 7 Changed 5 years ago by cehoyos

Replying to Đonny:

both give me error, though a little bit different then on my file

Add -qscale 2 to get the identical error message.

comment:9 Changed 5 years ago by cehoyos

  • Reproduced by developer set
  • Resolution changed from duplicate to fixed

Fixed by Michael in 2d3842f5

Note: See TracTickets for help on using tickets.