Rockbox Export
From MythTV Official Wiki
Author | Xobes |
Description | A pair of user jobs for transcoding recordings for use on Rockbox, and specifically the Sansa e250. Can trancode with or without commercials. Last tested with MythTV 0.21, some options may have changed. |
Supports |
Contents
Rockbox Export
These scripts are what I use to convert mythtv recordings to smaller versions able to be played in rockbox[1] on my SanDisk Sansa e250.
The video and audio bit rates, as well as the resolution, were painstakingly tweaked to find an acceptable rate for the specific player I use. These files may prove to be a good starting point for someone else.
Note: I placed all these files in my home directory in a bin directory (/home/xobes/bin/) you'll probably want to use a different, yet similar, location.
Set up a User Job
/home/xobes/bin/myth_small_mpeg_no_commercials %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"
/home/xobes/bin/myth_small_mpeg %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"
The Code
mk_rockbox_mpg
This script is used by both of the previous example scripts. This is where the conversion actually happens.
#!/bin/sh # programs NICE="/usr/bin/nice -n19" FFMPEG="/usr/bin/ffmpeg" # set up the options (hard coded 4:3 right now) displayresolution="224x160" vbitrate="200k" abitrate="128k" fps="25" FM_ARGS="-threads 2 -y -i $1 -r $fps -s $displayresolution -vcodec mpeg2video -b $vbitrate -ab $abitrate -ac 2 -ar 44100 -acodec libmp3lame $2" # run the commands $NICE $FFMPEG $FM_ARGS echo $OUTFILE
myth_small_mpeg_no_commercials
myth_small_mpeg_no_commercials.sh
#!/bin/sh # expecting: CHANID="$1" STARTTIME="$2" TITLE="$3" SUBTITLE="$4" OUTDIR="/myth/storage1/exports/rockbox" # programs NICE="/usr/bin/nice -n19" MYTHTRANSCODE="/usr/bin/mythtranscode" MYTHCOMMFLAG="/usr/bin/mythcommflag" CONVERT="/home/xobes/bin/mk_rockbox_mpg" SED="/bin/sed" # convert space laden variables to have underscores instead (not used in lookup) sed_str="s/[$\!@\/:;~#%^&*\`\(\)\"\'<>,.?]//g" OTITLE=`echo $TITLE | $SED -e 's/[[ \t]]*/_/g' | $SED -e $sed_str` OSUBTITLE=`echo $SUBTITLE | $SED -e 's/[[ \t]]*/_/g' | $SED -e $sed_str` # files TMPFILE="/tmp/$1_$2.tmp" OUTFILE="$OUTDIR/$OTITLE-$OSUBTITLE-$STARTTIME.mpg" # options MC_ARGS="-c $CHANID -s $STARTTIME --gencutlist" MT_ARGS="--showprogress -p autodetect -c $CHANID -s $STARTTIME --honorcutlist --mpeg2 -o $TMPFILE" # bring it all together: echo flag commercials $NICE $MYTHCOMMFLAG $MC_ARGS echo export commercial-free video stream $NICE $MYTHTRANSCODE $MT_ARGS echo reduce commercial-free video stream $CONVERT $TMPFILE $OUTFILE echo remove temporary files rm -f $TMPFILE rm -f $TMPFILE.map
myth_small_mpeg
#!/bin/sh # expecting: CHANID="$1" STARTTIME="$2" TITLE="$3" SUBTITLE="$4" OUTDIR="/myth/storage1/exports/rockbox" # programs NICE="/usr/bin/nice -n19" MYTHTRANSCODE="/usr/bin/mythtranscode" MYTHCOMMFLAG="/usr/bin/mythcommflag" CONVERT="/home/xobes/bin/mk_rockbox_mpg" SED="/bin/sed" # convert space laden variables to have underscores instead (not used in lookup) sed_str="s/[$\!@\/:;~#%^&*\`\(\)\"\'<>,.?]//g" OTITLE=`echo $TITLE | $SED -e 's/[[ \t]]*/_/g' | $SED -e $sed_str` OSUBTITLE=`echo $SUBTITLE | $SED -e 's/[[ \t]]*/_/g' | $SED -e $sed_str` # files TMPFILE="/tmp/$1_$2.tmp" OUTFILE="$OUTDIR/$OTITLE-$OSUBTITLE-$STARTTIME.mpg" # options MC_ARGS="-c $CHANID -s $STARTTIME --gencutlist" MT_ARGS="--showprogress -p autodetect -c $CHANID -s $STARTTIME --mpeg2 -o $TMPFILE" # bring it all together: echo export commercial-laden video stream $NICE $MYTHTRANSCODE $MT_ARGS echo reduce commercial-free video stream $CONVERT $TMPFILE $OUTFILE echo remove temporary files rm -f $TMPFILE rm -f $TMPFILE.map