Guest User

Untitled

a guest
Jun 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # mythtv multi-pass auto-transcode to x264 with HandBrakeCLI, remove commercials, and delete original recording bash script
  4.  
  5. # variables
  6. # $1 must be the directory/file to be transcoded. (in mythtv enter: "%DIR%/%FILE%")
  7. # $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")
  8. # $3 must be chanid (in mythtv enter: "%CHANID%")
  9. # $4 must be starttime. (in mythtv enter: "%STARTTIME%")
  10. # full userjob command should look like this: /path/to/this-script/nameofyourscript.sh "%DIR%/%FILE%" "/path/to/output-dir/%TITLE% - %PROGSTARTISO%.mp4" "%CHANID%" "%STARTTIME%"
  11.  
  12. # a temporary working directory (must be writable by mythtv user)
  13. TEMPDIR="/home/mythtv/workdir/"
  14.  
  15. # MySQL database login information (for mythconverg database)
  16. DATABASEUSER="mythtv"
  17. DATABASEPASSWORD="mythtv"
  18.  
  19. # MythTV Install Prefix (make sure this matches with the directory where MythTV is installed)
  20. INSTALLPREFIX="/usr/local/bin"
  21.  
  22. # go to correct working dir
  23. cd $TEMPDIR
  24.  
  25. # remove commercials
  26. $INSTALLPREFIX/mythcommflag -c "$3" -s "$4" --gencutlist
  27. $INSTALLPREFIX/mythtranscode --chanid "$3" --starttime "$4" --mpeg2 --honorcutlist
  28. $INSTALLPREFIX/mythcommflag --file "$1" --rebuild
  29.  
  30. # handbrake converting
  31. # 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"
  32. HandBrakeCLI -i "$1" -o "$2" -f m4v --preset="AppleTV 2"
  33.  
  34. # 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)
  35. rm $1
  36. rm $1.100x75.png
  37. rm $1.85x64.png
  38. rm $1.png
  39. echo "DELETE FROM recorded WHERE chanid='$3' AND starttime='$4';" > remove-original-recording.sql
  40. mysql --user=$DATABASEUSER --password=$DATABASEPASSWORD mythconverg < remove-original-recording.sql
Add Comment
Please, Sign In to add comment