[FFmpeg-trac] #3327(avformat:new): libavformat fails to detect some mp3 files reliably

FFmpeg trac at avcodec.org
Mon Jan 27 11:23:15 CET 2014

#3327: libavformat fails to detect some mp3 files reliably
             Reporter:  gjdfgh      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  mp3         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |

Comment (by cehoyos):

 Replying to [comment:5 gjdfgh]:
 > >Are you sure that if a format is currently only detected by extension
 > I don't know it's what I would expect.
 > avformat.h says: `#define AVPROBE_SCORE_EXTENSION  50 ///< score for
 file extension`

 I completely forgot: Another good example on how great the "cosmetics"
 are, thank you for pointing that out!

 > So yes, I would expect that if the extension matches, that value is

 It is just a wrong commit (that nobody so far complained about but you
 fortunately know where to direct your flames).

 > Maybe I'm wrong; it does look like the score is a little bit too high
 for that, as it's much higher than the "safe" score AVPROBE_SCORE_RETRY+1,
 which is 26.

 > As for whether to return 25 or 26 on a "good guess", I think it would be
 good to return 26 is there are signs that this might be a good mp3 file,
 probing uses a good amount of data (e.g. 1 MB), and there are no other
 formats with better score.

 So you agree that what FFmpeg reports is correct? After all, it does
 report the correct file type or do I miss something?

 Maybe unrelated: Note that you cannot simply raise a score because mp3,
 mpegvideo, mpeg-ps, mpeg-ts etc. fight for the "best" score for many real-
 world samples.

 > Anyway, currently mp3 probing is pretty bad. For example, libavformat
 recognizes a random ELF binary as mp3 with probe score 50 after only 64KB
 of data!

 *Please* provide such samples!

 > And that while legitimate mp3s are not recognized reliably, even when
 passing the whole file to the probe function!

 Define "reliably": Afaict, for the file in question, FFmpeg succeeds with
 auto-detection (which is apparently not trivial, see "other"
 applications), I don't find "I am not 100% sure" so bad for mp3 files with
 large attachments.

 > Using the file extension instead of the sophisticated probing in
 mp3_read_probe would be more reliable.

 This opinion seems to be in strong contrast to what FFmpeg stands for
 (since forever) and most people always saw that as one of the largest
 advantages over WMP etc.
 And it was always considered a bug that there is no auto-detection for
 image types.

 > >avconv
 > Didn't perform better on this sample, AFAIR.

 It performs extremely bad on this (and some related) sample.

 Note that I am not saying there is no issue: If the extension and the
 auto-detection agree, the score should probably be raised.

Ticket URL: <https://trac.ffmpeg.org/ticket/3327#comment:6>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list