Archive for the ‘MythTV’ Category

Removing Letterboxing in MythTV

Sunday, July 6th, 2008

I currently record all my shows in MythTV using a couple of Hauppauge PVR-[12]50’s. This works great, but I sometimes record shows originally  filmed in HD and they show up as letterboxed 4:3 shows. This isn’t a problem when I play them back on a standard def 4:3 display, but when played back on my widescreen displays they end up having a black border all they way around the show. I know I can just use the playback menu  ‘adjust fill’ option and set it to ‘full’ in order to fix this, but that has to be done every time I start playback. I wish there was a way for MythTV to automatically detect this situation and automatically select the correct playback fill.

To handle this situation, I created a small ‘user job’ script that I run automatically on the shows that I know will be recorded in a letterboxed format. It takes the original 4:3 mpeg2 recording and crops 60 pixels off the top and bottom and re-encodes it to a 16:9 aspect mpeg2 file. It then replaces the original file with the transcoded version, updates the mythconverg database to reflect the changed file settings, runs mythcommflag to rebuild the seektable (ffw/rwd doesn’t work without this) and finally runs a lossless mythtranscode with the –mpeg2 option (length of the recording is incorrectly shown without this).

The following is that script… (more…)

Scripting remote execution with SSH

Saturday, May 10th, 2008

Today, while doing some maintenance on my MythTV master backend, I rebooted it, but forgot to restart the backend services on my slave backends. Of course this meant that I missed some recordings. This started me thinking about how I could automate the process of restarting the remote backend processes whenever I started the master backend process. The solution was to configure ssh to authenticate between the machines using a public/private keypair, rather than using password authentication. I could then write a script that would ssh to the slave machines and restart their mythbackend services.

Setting up the ssh authentication is simple. Let’s say I want to run a script from a machine named mythmbe and have it execute a command using the username mythtv on the remote machine named mythbe1

First, generate a private/public keypair using ssh-keygen, which will be stored in ~/.ssh

$ ssh-keygen -t dsa

Now copy the public key to every remote machine you want to ssh in to without supplying a password…

$ scp ~/.ssh/ mythtv@mythbe1:~mythtv/.ssh/authorized_keys

You can now log in to the remote machine with ssh without needing to supply a password. The public key you copied to the remote machine will be tested against your private key to verify your identity whenever you try to connect. To test this, try something like…

$ ssh mythbe1 /sbin/service mythbackend restart