mp3 VBR histogram?

b. f. bf1783 at
Wed Aug 5 22:50:07 UTC 2009

On 8/5/09, Ian Smith <smithi at> wrote:
> On Wed, 5 Aug 2009, b. f. wrote:
>  >
>  > 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  }' -

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

Oh, I thought you wanted the numbers.  Well, awk is still your friend.
 You could use something like:

mp3_check -avv sample.mp3 | awk -v minbr=32 -v maxbr=448 -v
maxwidth=80 -v dispchar="*" '/BitRate/ {
Num=int(($2-minbr)/(maxbr-minbr)*maxwidth); bar=""; for (i=0; i < Num;
i++) bar=bar dispchar; print bar } '

instead (and probably there are more elegant ways to do this if you
know awk well).


More information about the freebsd-multimedia mailing list