[MPlayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.32,1.33

Rich Felker dalias at aerifal.cx
Mon Apr 18 20:45:03 CEST 2005


On Mon, Apr 18, 2005 at 04:25:56PM +0200, Moritz Bunkus wrote:
> Hey,
> 
> > An acceptable alternative would be brute force scanning, but only
> > considering header _chains_ in deciding what type the file is
> > (sequences of headers each pointing to the next one, or at least to a
> > point before the next one).
> 
> Agree. My experience with AC3 and MP3 detection in ogmtools/mkvtoolnix
> was that
> 
> - garbage is only present at the start of the file (e.g. extracted from
>   AVIs created with NanDub or other f'cked up software)
> 
> - once you find n (e.g. five) consecutive headers you can be pretty sure
>   that it's a raw MP3/AC3 file. Consecutive means that the next packet
>   starts exactly at first_pos + first_length
> 
> - if you find garbage in the middle then you probably have another file:
>   MPEG PS/SS, AVI etc. File type detection for such files has to be done
>   before audio file type detection because both the MP3 and the AC3
>   headers are not unique enough in their patterns. "RIFF" at file
>   position 0 ( = AVI) is.

Agree with all three. Actually I think 2 consecutive headers should be
safe though..

> - never underestimate the problem with ID3 tags. Those may appear at the
>   start of the file. And very, very few files even contain a complete
>   image in them...

I wrote code that skips the id3v2 tag, so this is no problem unless
some bastard removed it.. :)

> - probing 3000 bytes is definitely not enough. Neither for AC3 nor for
>   MP3.

It was 30000. This should be enough, but somehow it wasn't according
to Reimar.

Rich




More information about the MPlayer-cvslog mailing list