[MPlayer-users] How to correct samplerate of mp3 stream in avi?
D Richard Felker III
dalias at aerifal.cx
Tue Oct 7 18:09:35 CEST 2003
On Tue, Oct 07, 2003 at 07:16:56AM -0700, rgselk wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> --- D Richard Felker III <dalias at aerifal.cx> wrote:
> > On Tue, Oct 07, 2003 at 06:13:10AM -0700, rgselk wrote:
> > > I have an avi file with a mp3 stream which is claiming to have a
> > > samplerate of 32kHz. However this should be 48kHz. The two bits in
> > the
> > > header indicating the frequency (bit 10,11) now read '10' and
> > should
> > > read '01'.
> > > Is there a tool to modify this direct? Or else how do I know the
> > offset
> > > of this header, so I can write a small perl script to do the
> > > manipulation.
> >
> > Are you sure this is the problem? The samplerate is also stored in
> > the
> > avi header, so IMO it's much more likely that it's correct in the
> > actual mp3 stream and wrong in the avi header. Try dumping the mp3
> > stream with -dumpaudio and check that it plays correctly. Dumping
> > also
> > has the effect that you can write down the first few bytes of the mp3
> > stream, then search for them with a hex editor in the avi file, in
> > case you do end up needing to edit the mp3 stream.
> >
> > On the other hand, if it's the avi header you need to edit, just
> > search with a hex editor for the first occurrance of 32000 (little
> > endian) in the avi file and change it to 48000.
>
> In the attached (edited) log I see a 'Samplerate: 48000' in the STREAM
> header / WAVE Format. mp3lib/sr1.c prints '32000 Hz'.
> I tried mplayer -dumpaudio, but that did not result in a mp3 file at
> all. The first 996 bytes of the resulting stream.dump are zero. :-(
>
> It seems the avi header is correct in this case and not the mp3
> header...
I __seriously__ doubt the value in the mp3 headers is incorrect,
unless it's just the first mp3 packet that's corrupt. There is no
global mp3 header, but one in every single packet, so the only way
they could all be wrong is if some terribly broken software was used
to encode...
Rich
More information about the MPlayer-users
mailing list