Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2009 22:50:05 +0000
From:      "b. f." <bf1783@googlemail.com>
To:        Ian Smith <smithi@nimnet.asn.au>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: mp3 VBR histogram?
Message-ID:  <d873d5be0908051550i7f830668la3c982f5e7117e3a@mail.gmail.com>
In-Reply-To: <20090805235234.H19821@sola.nimnet.asn.au>
References:  <d873d5be0908050251u1562609dh595b54e1e47f0137@mail.gmail.com> <20090805235234.H19821@sola.nimnet.asn.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/5/09, Ian Smith <smithi@nimnet.asn.au> 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).

b.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d873d5be0908051550i7f830668la3c982f5e7117e3a>