mp3info and python

Brett g Porter BgPorter at NOartlogicSPAM.com
Thu Dec 6 09:05:58 EST 2001


"Dave Pawson" <DaveP at dpawson.freeserve.co.uk> wrote in message
news:Xns916F3C471DB7EdavePdpawsonfreeserv at 195.92.195.157...
> "Brett g Porter" <BgPorter at NOartlogicSPAM.com> wrote
>
> > If there's ID3 data at the end of the file, subtract that from the
> > filesize before calculating.
>
> Is that of a fixed size please?

See:
http://home.swipnet.se/grd/mp3info/mp3doc.html
www.id3.org
http://www.dv.co.yu/mpgscript/mpeghdr.htm
> the functions imply that the header info is stored in the id3 'header'
> if thats the right term.
>
> >
> > If it's a variable bit rate file, you will need to scan through the
> > file and count frames, multiplying by the constant # of milliseconds
> > per frame.
>
> No, its not vbr, and I've not seen such a constant in the
> file.
That's because the constant is implicit. The way that MPEG compressed audio
works (in grotesque simplification -- partly because the space vs tab war
here makes me sensitive to being OT, partly because I don't want to look
like I'm claiming a deeper grasp than I have) is that the compressing part
of the codec chunks up the audio into 24 ms long 'frames' (where 24 is the
value I remember, but it's been a while...) and analyzes each frame
separately (more or less). One of the URLs above has a better explanation

> Re my original question, is the total time of the file fixed
> in this id3 data, or is it the sum of each frame, possibly where
> each frame might be a song on a CD album?
The time of the file can be calculated as before once you know the bitrate
it was encoded at. A 128K MP3 file occupies 16000 bytes for every second of
audio.

See above for frame info.
> Other id3 heading stuff implies that might be the case.
> In which case, how do I skip from one set of header data to another?
>
> regards DaveP
>





More information about the Python-list mailing list