mp3 VBR histogram?

Ian Smith smithi at nimnet.asn.au
Wed Aug 5 17:05:16 UTC 2009


On Wed, 5 Aug 2009, b. f. wrote:
 > >does anyone know anything that can produce the sort of ASCII histogram
 > >that lame produces while encoding in VBR, from an existing .mp3 file?
 > >
 > >I'm interested in analysing the bitrate distribution of frames of a VBR
 > >live stream, though I don't mind saving it to a disk file if necessary.
 > 
 > Any application that can sweep through an mp3 and read the frame
 > headers should have code that you can adapt for this purpose, and
 > there are many such pieces of software in Ports (every mp3 decoder,
 > and many utilities).  If you want something ready-made, and efficiency
 > isn't of paramount importance, you could use, for example,
 > audio/mp3plot or audio/mp3stat on files.
 > 
 > I've dumped frame bitrates of mp3 files before from the command-line
 > using audio/mp3_check and something like:
 > 
 > mp3_check -avv sample.mp3 | awk '/BitRate/ { print $2  }' -

192
160
160
320
96
160
112
160
128
160
128
160
160
224

That works well for extracting the raw frame bitrates, might try 
scripting up a simple histogram from that, the next rainy day.

 > audio/py-mad, a python interface to audio/libmad, has some example
 > code for reading mp3 streams, and could also be used for this purpose.

Thanks for the good clues.  Speed's not an issue; more about occasional
sampling than realtime monitoring.  mp3plot looks good on spec, still 
building; compiling boost very nearly ran this old laptop out of swap!

cheers, Ian


More information about the freebsd-multimedia mailing list