Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2009 23:14:21 +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:  <d873d5be0908051614m179c1481rb1a5f7358c594afd@mail.gmail.com>
In-Reply-To: <d873d5be0908051550i7f830668la3c982f5e7117e3a@mail.gmail.com>
References:  <d873d5be0908050251u1562609dh595b54e1e47f0137@mail.gmail.com> <20090805235234.H19821@sola.nimnet.asn.au> <d873d5be0908051550i7f830668la3c982f5e7117e3a@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/5/09, b. f. <bf1783@googlemail.com> wrote:
> 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).

I definitely need that cup of coffee.  Histogram, not temporal history
-- right.  <gnashes teeth>  You can use, for a simple numerical
histogram:

mp3_check -avv sample.mp3 | awk '/BitRate/ { nbr[$2]=nbr[$2]+1 } END {
for (br in nbr) print br, nbr[br] }' | sort -g

b.



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