ogg2enc: simple wrapper for oggenc

Copyright (c) 2003 John Stracke. Released under the GPL.

Download (Perl script; doesn't require any special modules).

ogg2enc is a wrapper to run oggenc twice. It is meant to be a drop-in replacement for oggenc, more or less.

The point of ogg2enc is to produce two versions of the Ogg Vorbis file, one at high quality and one at low quality (64kbps). I find this useful because I like having a high-quality file on my desktop, but I like having a small file on my handheld; and Ogg is good enough that 64kbps is quite passable to my ear. (My initial drive to try 64kbps came because I wanted to NFS-mount my Ogg files from work over my home VPN; the VPN would sometimes stutter at quality 4, about 128kpbs, but was fine at 64kbps.) I use grip to rip and encode CDs, so I wanted a script that would act like oggenc from grip's point of view, but produce two files.

The first oggenc run encodes at 64kbps, and modifies the output file path by replacing the first directory named /ogg/ with /ogg64/. So, for example, -o ~/music/ogg/foo.ogg becomes -o ~/music/ogg64/foo.ogg; -n ~/music/ogg/%a-%t.ogg becomes -n ~/music/ogg64/%a-%t.ogg. The first run also suppresses -q/--quality, -m/--min-bitrate, and -M/--max-bitrate.

The second run gets ogg2enc's command-line arguments as is. So you can do, say, "ogg2enc -q 10 ...", and you'll get one file at quality 10 and one at 64kbps.

There is also one extra command-line argument that ogg2enc recognizes and does not pass to oggenc: --in-parallel tells ogg2enc to run the two oggenc instances at the same time. Of course, this is probably useful only if you have multiple processors, since oggenc is fully capable of saturating a CPU. I wrote it because I have two CPUs, but I don't actually use it much, since I run ogg2enc under grip, which can run two encoders at once anyway, and which would probably be confused by seeing the output from both oggencs simultaneously.

At this time, ogg2enc does not attempt to harmonize the progress output of the two oggenc instances, which means that grip, for example, shows a ludicrous progress bar while the first one is running, and then a reasonable one while the second one is running.