Opened 10 years ago

Closed 5 years ago

#304 closed defect (needs_more_info)

wrong detection: "Format mp3 detected only with small score of 1"

Reported by: AndreAdrian Owned by:
Priority: normal Component: avformat
Version: 0.7.1 Keywords: mp3 mjpeg probe
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


The IP camera Lumenera Le165 uses MJEPG video codec. If ffmpeg version 0.7.1 is used together with OpenCV version 2.3.0 the Le165 mjpeg codec is miss-detected as mp3 codec. A simple fix (work around) is possible.
In file libavformat/utils.c
In function av_probe_input_buffer()
around source code line 592
change from

if (probe_size < offset) {




if (probe_size < offset) continue;
if (score <= 1) continue;

Justification: With a low score of 1 the mp3 codec is now ignored. OpenCV and ffmpeg find now the correct codec.
Disadvantage: Cases where codec was correct with score == 1 are now broken.

Attachments (1)

test2.jpg (8.1 KB) - added by alexschrod 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by cehoyos

  • Analyzed by developer unset
  • Reproduced by developer unset
  • Status changed from new to open
  • Type changed from enhancement to defect

Please add command line and complete, uncut output of ffmpeg.

comment:2 Changed 9 years ago by michael

  • Resolution set to needs_more_info
  • Status changed from open to closed

Please provide a sample file that is misdetected, iam happy to fix the detection. There is nothing we can do without a sample file, the suggested change looks wrong.

Changed 5 years ago by alexschrod

comment:3 Changed 5 years ago by alexschrod

  • Resolution needs_more_info deleted
  • Status changed from closed to reopened

I've attached a file that triggers this mp3-detection behavior. This is the output from ffmpeg:

ffmpeg version N-76526-ga5202bc Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (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-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --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-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 14.100 / 57. 14.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 15.100 /  6. 15.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[mp3 @ 005bab20] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 005d21e0] Header missing
    Last message repeated 1 times
[mp3 @ 005bab20] decoding for stream 0 failed
[mp3 @ 005bab20] Could not find codec parameters for stream 0 (Audio: mp3, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
C:\Users\User\Desktop\test2: could not find codec parameters
Input #0, mp3, from 'C:\Users\User\Desktop\test2':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: mp3, 0 channels, s16p
At least one output file must be specified
Last edited 5 years ago by alexschrod (previous) (diff)

comment:4 Changed 5 years ago by alexschrod

BTW, it's important that the file isn't actually named "whatever.jpg". I can only trigger the detection fault if the file has an incorrect (or missing) file extension.

comment:5 Changed 5 years ago by cehoyos

  • Keywords probe added; misdetection removed
  • Resolution set to needs_more_info
  • Status changed from reopened to closed

Please do not reopen ancient tickets, instead test current FFmpeg git head and open a new ticket if the issue is reproducible.

Note: See TracTickets for help on using tickets.