MythTV, again

I can't get over the air PBS reception at my house in Boulder, so I sent my TV tuner card to my parents in Cincinnati. Now, mythtv is running at their house and I'll be downloading the compressed files from there. In a weird way, it makes sense.

I've been working all day at trying to get the video transcoded acceptably. There have been lots of tests where the file sizes are too big, the transcoding takes too long, or the pictures and sound are not synchronized.

Great page explaining x264 codec options in mencoder.

Running user jobs in mythtv.

encode NTSC (640x480)

#!/bin/bash

# input_filename title start_time

INPUT_NAME=$1
OUTPUT_NAME=$2-$3.avi

echo $INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME >> /tmp/encode.log

# Medium quality, fast
mencoder /home/mythtv/$INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME \
  -oac mp3lame -lameopts vbr=3:br=128 \
  -vf crop=640:472:0:8,lavcdeint,scale=464:348 \
  -ovc x264 -x264encopts threads=2:subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b \
  2>&1

# High quality
# mencoder /home/mythtv/$INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME \
#   -oac mp3lame -lameopts vbr=3:br=128 \
#   -vf crop=640:472:0:8,lavcdeint,scale=320:240 \
#   -ovc x264 -x264encopts threads=2:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b \
#   2>&1

encode HD to 624x352

#!/bin/bash

# input_filename title start_time

INPUT_NAME=$1
OUTPUT_NAME=$2-$3.avi

echo $INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME >> /tmp/encode.log

mencoder /home/mythtv/$INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME \
  -oac mp3lame -lameopts vbr=3:br=128 \
  -vf lavcdeint,scale=624:352 \
  -ovc x264 -x264encopts threads=2:subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b \
  2>&1

encode HD to 1280x720

#!/bin/bash

# input_filename title start_time

INPUT_NAME=$1
OUTPUT_NAME=$2-$3.avi

echo $INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME >> /tmp/encode.log

mencoder /home/mythtv/$INPUT_NAME -o /home/mythtv/transcoded/$OUTPUT_NAME \
  -oac mp3lame -lameopts vbr=3:br=128 \
  -vf lavcdeint,scale=1280x720 \
  -ovc x264 -x264encopts threads=2:subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b \
  2>&1

MythTV setup

Using mythweb, set the variables for user jobs to run the scripts (do this 3 times):

/usr/local/bin/encode624 %FILE% %TITLE%-%SUBTITLE% %STARTTIME%

Bugs

Myth will pass characters that make the script barf, like parentheses, that should really be stripped.

Comments

why use lame?

try this if u get a min.

-oac faac -faacopts br=64:mpeg=4:object=2:raw -channels 2 -srate 48000 A bit better quality and smaller file size ;)