I currently have approximately 400gb of old anime fansubs lying around on hard drives here at home, and they need to be burnt off to dvd’s in the worst way. I’ve been stalling until a few days ago when I finally decided to put some sort of effort into the archival. After three days of diligence, I have managed to produce a whopping 6 discs. Yup, six.
Why the slowness when it only takes 15 minutes to burn a dvd at 4x and only 30 more minutes to copy the files across the network in order to burn? Because I’m picky.
I want my shows to fit neatly onto discs. Given a standard issue series of 26 episodes at 175mb per file, it fits almost perfectly on a normal dvd. At least, it would, if the discs were like 50mb larger
So, I shuffle and I juggle, and I try to find ways to fit the blasted data onto discs w/o having single episode leftovers… and usually I fail. I’d been trying to edit some of the larger files, cropping the closing credits or something to trim enough data to make things work. This is iffy at best – most of the time I have to either re-encode the video (a badness) or I suffer problems with a/v sync getting thrown all out of whack.
And then, a few seconds ago, it finally hit me. I can turn them into OGM files
I mean, I use Vorbis to cut filesizes in half for my music library, so why not on my videos as well?
The thought had occurred to me previously, but I’d always dismissed it because the typical episode’s audio track only takes up something like 20mb, and chopping 8-10 meg off of a file isn’t enough to make much of a dent in my 50mb quota. At least, that’s how my thought process was going at the time. Who knows what I was thinking. 8-10mb times 26 files makes an enormous difference
And it’s a fast process too. I think my script takes something like 3 minutes per episode to re-package when running on Hedwig. And I’m normalizing the audio tracks while I’m at it.
Total savings on a 26 episode series when going from 128kbps CBR mp3 to ~64kbps VBR Vorbis? Well, I was hoping for about 250mb. After 12 episodes converted, however, I have already saved 163mb
Woo! This puts me on track for an extra hundred meg that I wasn’t expecting. Oh, and the files sound good too.
Me likey Vorbis lots. Heap big lots.
The script in question?
#!/usr/local/bin/php
<?
exec('ls *.avi', $files);
foreach( $files as $file ) {
$fn = substr($file, 0, -4);
if( file_exists("$fn.ogm") ) {
echo "$fn.ogm already exists, skipping\n";
continue;
}
echo "OGMifying $fn\n----------\n";
passthru("mplayer $fn.avi -vc dummy -vo null -ao pcm:file=$fn.wav");
passthru("normalize $fn.wav");
passthru("oggenc -b 64 $fn.wav");
unlink("$fn.wav");
passthru("ogmmerge -o $fn.ogm --noaudio $fn.avi $fn.ogg");
unlink("$fn.ogg");
}
?>
It’s kind of clunky, really doesn’t need to be done in php, and could be tuned up quite a bit, but meh, it’s doing the job quite happily, and without supervision
I should think about making it traverse the directory tree recursively and let it run overnight to convert everything.
Update
Yeehaw! Series completed. 387mb saved over 26 episodes. I’m busily making a simple little bash script to recursively call the php script above…