Difference between revisions of "Rockbox Export"

From MythTV Official Wiki
Jump to: navigation, search
m (Mk rockbox mpg moved to Rockbox Export: I chose a stupid name, didn't realize I'd have to fill out a form to pick a better one.)
(Set up a User Job)
Line 4: Line 4:
 
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.
 
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.
  
==Set up a [[User Job]]==
+
==Set up a User Job==
 
<pre>myth_small_mpeg_no_commercials %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"</pre>
 
<pre>myth_small_mpeg_no_commercials %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"</pre>
 
<pre>myth_small_mpeg %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"</pre>
 
<pre>myth_small_mpeg %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"</pre>

Revision as of 03:16, 25 November 2008

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.

Set up a User Job

myth_small_mpeg_no_commercials %CHANID% %STARTTIME% "%TITLE%" "%SUBTITLE%"
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

#!/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/username/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 laben 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