From owner-freebsd-multimedia@FreeBSD.ORG Wed Aug 5 23:14:23 2009 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E09C106566B for ; Wed, 5 Aug 2009 23:14:23 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id F37B68FC19 for ; Wed, 5 Aug 2009 23:14:22 +0000 (UTC) Received: by ey-out-2122.google.com with SMTP id 9so212504eyd.7 for ; Wed, 05 Aug 2009 16:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cWEnQgyVKJVWIw4OKfFmIdglZ0BicEiHiiIsAcOUBY8=; b=gJXxaZRriPSeY/CtBv9L1vYuFI8BbBwpECvu5dYvgBmDqcKxpteHPY3yAMsCDCE6fC gD81vvgF6hmHTX5nFVsPlnkl26NzLyLHzLu7r86kPamaSfu3AVUbUjDteSSQV5Wr2gE7 ItFwfwjNJqZVtbGVjB6TIyzDJBJQ1xOhiDz5s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iGMcOMrw6oaP1N0zYKi/xIX/QjMxDGdZPfyRu8ucdERil5q0TItTtlCIeGpjM4cGhk c4aQIFpdu14eqQWE3pOY7D5s7Veqim6Pr2u/N44zL7uRU4otV+hqMcsSyzAOptKWjh+L oI7q1HsgOkbzxHhi2BdCX4swt0rzIZ30DXLWc= MIME-Version: 1.0 Received: by 10.216.72.83 with SMTP id s61mr1815993wed.79.1249514061807; Wed, 05 Aug 2009 16:14:21 -0700 (PDT) In-Reply-To: References: <20090805235234.H19821@sola.nimnet.asn.au> Date: Wed, 5 Aug 2009 23:14:21 +0000 Message-ID: From: "b. f." To: Ian Smith Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-multimedia@freebsd.org Subject: Re: mp3 VBR histogram? X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2009 23:14:23 -0000 On 8/5/09, b. f. wrote: > On 8/5/09, Ian Smith 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. 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.