Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # mythtv multi-pass auto-transcode to x264 with HandBrakeCLI, remove commercials, and delete original recording bash script
- # variables
- # $1 must be the directory/file to be transcoded. (in mythtv enter: "%DIR%/%FILE%")
- # $2 must be the output directory / file name. The directory must be writeable by the mythtv user (in mythtv enter: "/path/to/output-dir/%TITLE% - %PROGSTARTISO%.mkv")
- # $3 must be chanid (in mythtv enter: "%CHANID%")
- # $4 must be starttime. (in mythtv enter: "%STARTTIME%")
- # full userjob command should look like this: /path/to/this-script/nameofyourscript.sh "%DIR%/%FILE%" "/path/to/output-dir/%TITLE% - %PROGSTARTISO%.mp4" "%CHANID%" "%STARTTIME%"
- # a temporary working directory (must be writable by mythtv user)
- TEMPDIR="/home/mythtv/workdir/"
- # MySQL database login information (for mythconverg database)
- DATABASEUSER="mythtv"
- DATABASEPASSWORD="mythtv"
- # MythTV Install Prefix (make sure this matches with the directory where MythTV is installed)
- INSTALLPREFIX="/usr/local/bin"
- # go to correct working dir
- cd $TEMPDIR
- # remove commercials
- $INSTALLPREFIX/mythcommflag -c "$3" -s "$4" --gencutlist
- $INSTALLPREFIX/mythtranscode --chanid "$3" --starttime "$4" --mpeg2 --honorcutlist
- $INSTALLPREFIX/mythcommflag --file "$1" --rebuild
- # handbrake converting
- # HandBrakeCLI -e x264 -b 1000 -a 1 -E faac -B 128 -R 44.1 -6 dpl2 -f mp4 --crop 0:0:0:0 -d fast -p -m -2 -T -x ref=2:bframes=2:me=umh -i "$1" -o "$2"
- HandBrakeCLI -i "$1" -o "$2" -f m4v --preset="AppleTV 2"
- # uncomment the following 6 lines to delete the original recorded show, associated picture files, and remove entry from database (make sure everything else works properly before trying this)
- rm $1
- rm $1.100x75.png
- rm $1.85x64.png
- rm $1.png
- echo "DELETE FROM recorded WHERE chanid='$3' AND starttime='$4';" > remove-original-recording.sql
- mysql --user=$DATABASEUSER --password=$DATABASEPASSWORD mythconverg < remove-original-recording.sql
Add Comment
Please, Sign In to add comment