--- date: "2006-01-18T02:48:06Z" title: My MythTV Scripts for Mostly-Automated DivX Encoding --- <p>Did I mention that I set up a <a href="http://mythtv.org/" title="Free Linux-based PVR/HTPC.">MythTV</a> machine several months ago? Anyway, I don't use the <a href="http://mythtv.org/" title="Free Linux-based PVR/HTPC.">MythTV</a> front-end; A recording server in my rack downstairs (<code>spud</code>) records scheduled programs. Afterwards, I re-encode recorded episodes as <a href="http://divx.com/" title="A fast, free, portable, and well-supported MPEG4 codec.">DivX5</a>-compatible <acronym title="Motion Picture Expert Group">MPEG</acronym>4 files (in an <acronym title="Audio/Video Interleaved">AVI</acronym> wrapper) on a faster machine (<code>picard</code>, go ahead, laugh at the hostname — you know you want to), then burn related shows off to <acronym title="Digital Video Disc">DVD</acronym>.</p> <p>I realize it's a slightly convoluted configuration, but it works well given my hardware constraints, and the fact that my <acronym title="Digital Video Disc">DVD</acronym> player (a <a href="http://www.amazon.com/exec/obidos/tg/detail/-/B000204SWE?v=glance" title="Awesome inexpensive DivX/XviD-capable DVD player.">Philips DVP642</a>), is <a href="http://divx.com/" title="A fast, free, portable, and well-supported MPEG4 codec.">DivX5</a>-aware. That said, I'm posting my scripts on the off-chance that pieces of them are useful to someone who wants to set up a similar system. Here's what's included in the tarball below:</p> <ul> <li>myth_convert.sh: convert <a href="http://mythtv.org/" title="Free Linux-based PVR/HTPC.">MythTV</a> NUV files to <a href="http://divx.com/" title="A fast, free, portable, and well-supported MPEG4 codec.">DivX5</a>-compatible <acronym title="Motion Picture Expert Group">MPEG</acronym>4 files.</li> <li>mi: A <a href="http://ruby-lang.org/" title="The Ruby programming language.">Ruby</a> script to create filesystem-friendly names for <acronym title="Audio/Video Interleaved">AVI</acronym> files encoded with <code>myth_convert.sh</code>.</li> <li>mim: quick shell script to create hard links based on an <code>egrep</code>-style regular expression.</li> </ul> <p>A typical session is as follows:</p> <pre><code># (after running myth_convert.sh) # see what's encoded mi | less mkdir dvd && cd dvd # create hard links to encoded episodes of that 70s show, the # colbert report, and the daily show, mim 70s_ colbert daily_show # remove the original cryptically-named <acronym title="Audio/Video Interleaved">AVI</acronym> files mimrm 70s_ colbert daily_show # create an iso of the <acronym title="Audio/Video Interleaved">AVI</acronym> files in the current directory, mkisofs -r -R -J -o 70s-colbert-daily.iso *.avi # burn a DVD of the episodes in question sudo dvdrecord -dao -v -speed=8 dev=/dev/hdc 70s-colbert-daily.iso # remove the <acronym title="Audio/Video Interleaved">AVI</acronym> and ISO files rm *.avi *.iso && cd .. && rmdir dvd </code></pre> <p>If you decide to use these scripts, please look through them and edit the paths (most have my shared <acronym title="Network File System">NFS</acronym> paths hard-coded), and double-check to make sure they won't do anything wacky with your systems. With that in mind, here's the tarball:</p> <p><a href="http://pablotron.org/files/pabs-mythtv_scripts-20060118.tar.gz" title="A handful of MythTV convenience scripts I've written.">Download pabs-mythtv_scripts-20060118.tar.gz</a> (<a href="http://pablotron.org/files/pabs-mythtv_scripts-20060118.tar.gz.asc" title="OpenPGP signature for this tarball.">Signature</a>)</p>