mp3 VBR histogram?

b. f. bf1783 at googlemail.com
Wed Aug 5 23:14:23 UTC 2009


On 8/5/09, b. f. <bf1783 at googlemail.com> wrote:
> On 8/5/09, Ian Smith <smithi at 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.


More information about the freebsd-multimedia mailing list