TIP_MythTV_to_iPod
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
|
Problem
You're eating dinner by yourself again, and you're bored out of your mind. Boy wouldn't it be nice if you had that South Park you recorded last night on your iPod so you do something while waiting for them to burn your food?
Setup
Required tools:
ffmpeg (use flag) nuvexport mythtv AtomicParsley
Emerge the required tools. Once they are installed, nuvexport needs to be configured
For nuvexport 0.5 copy .mythtv/config.xml to /etc/mythtv/.mythtv/config.xml Then create this config file and place it in the home directory
| File: ~/nuvexportrc.xml |
<mp4>
vbr = yes
# The small improvements by a multi-pass encoding are
# negated by the small video size, so don't waste your
# time encoding multiple times
mulitpass = no
quantisation = 4
crop = yes
# set this option to yes if you have lossy transcoders
# and would rather have nuvexport cut the recording
use_cutlist = no
# This is set to no, as the video size negates any
# noise, so it is waste of time
noise_reduction = no
# Even though we have a small video size, interlacing
# will still come through. This is one option you
# should not turn off to save time
deinterlace = yes
a_bitrate = 128
</mp4>
|
su to your mythtv user and create the following script in the home directory.
| File: ~/ipodencode.sh |
#!/bin/bash
# Edited 09.07.2008 -
# Fixed an issue where the name in iTunes was always the show name, not the episode name
# Set the HOST variable to your database host
HOST=192.168.0.1
DB=mythconverg
USERNAME=mythtv
PASSWORD=mythtv
# Set this path to where you'd like to save your videos (A samba share directory is highly recommended)
SAVEPATH="/videos/ipod"
MYSQLCMD="mysql $DB -h $HOST --skip-column-names -B -u $USERNAME --password=$PASSWORD"
NUVCMD="/usr/bin/nuvexport --noconfirm --mode=mp4 --infile=$1 --nice=8 --path=SAVEPATH --config=~/nuvexportrc.xml --filename=$1"
echo Running \"$NUVCMD\"
# set both of these to /dev/null if you are not using the 1 encoding at a time script
echo "" | $NUVCMD 2>/tmp/nuvencode_stderr.log 1>/tmp/nuvencode_stdout.log
# Load the db entries
TITLE=`echo "select recorded.title from recorded where basename='$1';" | $MYSQLCMD`
SUBTITLE=`echo "select recorded.subtitle from recorded where basename='$1';" | $MYSQLCMD`
DESCRIPTION=`echo "select recorded.description from recorded where basename='$1';" | $MYSQLCMD`
EPID=`echo "select syndicatedepisodenumber from recordedprogram, recorded where \
recorded.programid = recordedprogram.programid AND recorded.starttime = recordedprogram.starttime \
AND basename='$1';" | $MYSQLCMD`
TYPE=`echo "select program.category_type from program,recorded where \
recorded.programid=program.programid AND recorded.basename='$1' limit 1;" | $MYSQLCMD`
# Get the proper iTunes name
ITUNESNAME=""
if [ "$SUBTITLE" != "" ] ; then
ITUNESNAME="$SUBTITLE"
else
ITUNESNAME="$TITLE"
fi
# Work around files which may already exist with the same name
if [ "$SUBTITLE" != "" ] ; then
FULLTITLE="$SAVEPATH/$TITLE - $SUBTITLE"
else
FULLTITLE="$SAVEPATH/$TITLE"
fi
FILENAME="$FULLTITLE.mp4"
if [ -e "$FILENAME" ] ; then
COUNTER=2
FILENAME="$FULLTITLE.$COUNTER.mp4"
while [ -e "$FILENAME" ]; do
let COUNTER=COUNTER+1
FILENAME="$FULLTITLE.$COUNTER.mp4"
done
fi
# Check the recording type and set the meta data as need be
if [ "$TYPE" == "movie" ] ; then
echo AtomicParsley $SAVEPATH/$1.mp4 --stik "Movie" --title "$ITUNESNAME" --description "$DESCRIPTION" -o "$FILENAME"
AtomicParsley $SAVEPATH/$1.mp4 --stik "Movie" --title "$ITUNESNAME" --description "$DESCRIPTION" -o "$FILENAME"
else
echo AtomicParsley $SAVEPATH/$1.mp4 --stik "TV Show" --title "$ITUNESNAME" --TVShowName "$TITLE" --TVEpisode "$SUBTITLE" \
--description "$DESCRIPTION" --TVEpisodeNum "$EPID" -o "$FILENAME"
AtomicParsley $SAVEPATH/$1.mp4 --stik "TV Show" --title "$ITUNESNAME" --TVShowName "$TITLE" --TVEpisode "$SUBTITLE" \
--description "$DESCRIPTION" --TVEpisodeNum "$EPID" -o "$FILENAME"
fi
# Remove the temporary output from nuvexport
rm $SAVEPATH/$1.mp4
|
You may want to limit only one encoding at a time. You want to do this even if you have a multi-core machine, as ffmpeg will use as many cores as possible when encoding. To do this, all you need to do is:
| File: ~/ipodencodermgr.sh |
#!/bin/bash flock /tmp/ipodencode.lck -c "~/ipodencode.sh $1" |
Setup mythtv to use handle this user job
Use mythtv-setup to add a user job: ~/ipodencodermgr.sh %FILE%
Don't forget to set the executable flag on both scripts. Also, if you want status on the current job (only works when limited to 1 encoding at a time):
tail -F /tmp/nuvencode_stdout.log
How to Use It
Load your cut points and adjust them as need be Use a lossless transcoder (if possible, but you can use a lossy transcoder if need be) to remove these portions of the recording Run your new user job Load the recording on your iPod and go
If this has helped you, please say so on the discussion page. I want to know if this writeup is really helpful or a waste of my time.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.

