[MPlayer-dev-eng] Re: [Patch] Audio detection

Michael Behrisch behrisch at informatik.hu-berlin.de
Tue Apr 13 12:47:22 CEST 2004


On Wed, Mar 24, 2004 at 11:51:19PM +0100, Alban Bedel wrote:
> Hi Arpi,
> 
> on Wed, 24 Mar 2004 18:31:59 +0100 (CET) you wrote:
> 
> > Hi,
> > 
> > > Hello,
> > > I forgot to mention that my patch might also solve nehals problem,
> > > at least it does not skip the first frame if it is followed by valid 
> > > ones. So please apply ;-)
> > > 
> > > Michael
> > 
> > many mp3 files has bad first frame.
> > the most common cases are ascii art/nfo file in fake 2048 bytes frame
> > at the beginning of the file, and the xing vbr header.
> > 
> > they must be skipped before the decoder gets the samplerate/channels etc
> > info from them.
> 
> For those still not conviced and/or willing to improve mp3lib i uploaded
> a samples broken-first-frame.mp3 wich is inited at 32KHz instead of 44KHz.
> BTW it seems to also fail with the patch submited, even when mp3lib
> skip its frame. 

I fixed this with the new patch attached. I still want to point out, that 
checking only the first 1000 bytes (n<1000) is a point to discuss, maybe 
checking the whole file would also be a good solution.

> 
> > anyway i see there is a big problem: where should it be skipped?
> > in the demuxer? easy to do in demux_audio, but what about mp3 tracks
> > of avi, ogm etc?
> > in the codec? then at least mp3lib, libmad and libavcodec should be
> > able to do it. currently (afaik) only mp3lib skips the first frame.
> 
> In the codec seems better to me, so stream copy is as close as
> possible to the original. Those who want to mux proper mp3 stream
> would appreciate.

I dont think the codes is the right place. The demuxer has to determine 
whether it is mp3 at all and where the stream starts and imho
the stream starts at the first valid frame. Furthermore I think
skipping always is a bad idea since it is possible (at least with files)
to check whether a frame is followed by "similar" ones and to call the 
first frame in such a row the first of the stream (which could include
skipping many frames or no frame at all).

Michael




More information about the MPlayer-dev-eng mailing list