Code:
if [ -f "/storage/movies/$1.mkv" ]
then
case $2 in
"-f")
HandBrakeCLI --preset="High Profile" -i "/storage/movies/$1.mkv" -o "/storage/movies/mp4/$1.mp4" -N eng -s scan -F 1 --subtitle-burn
shift
;;
"-s")
HandBrakeCLI --preset="High Profile" -i "/storage/movies/$1.mkv" -o "/storage/movies/mp4/$1.mp4" -N eng --subtitle-burn
shift
;;
"-n")
HandBrakeCLI -i "/storage/movies/$1.mkv" -o "/storage/movies/mp4/$1.mp4"
shift
;;
"-hq")
HandBrakeCLI --preset="High Profile" -i "/storage/movies/$1.mkv" -o "/storage/movies/mp4/$1.mp4"
shift
;;
*)
HandBrakeCLI -i "/storage/movies/$1.mkv" -o "/storage/movies/mp4/$1.mp4"
;;
esac
sleep 10
if [ "$2" == "-off" ]
then
if ps ax | grep -v grep | grep HandBrakeCLI > /dev/null
then
echo "$(date) - Another encoding jobs is already running."
else
echo "$(date) - No other encoding jobs are running, shutting down server in 1 minute."
shutdown -hy 1
fi
fi
else
echo
echo "Filename /storage/movies/$1.mkv does not exist!"
echo
echo "List of files in movies folder:"
ls /storage/movies/*.mkv -1
echo
echo "Usage: nohup ./mkv2mp4 \"filename\" {switches} > /var/log/cdrip.log &"
echo
echo "Switches:"
echo " -n Normal quality (default)"
echo " -hq High quality"
echo " -s High quality with english subtitles"
echo " -f High quality with forced english subtitles"
echo " -off Shutdown server after encoding (see note below)"
echo
echo "Notes:"
echo " * Please enter filename without .mkv extension"
echo " * Don't enter full path MKV files are picked up from /storage/movies"
echo " * You need to make sure you have a folder /storage/movies/mp4"
echo " * Output from cdrip.log can be monitored from the Web GUI (Ripping Status)"
echo " * If you are already ripping or encoding, choose a different log file name"
echo " * If running multiple jobs with the shutdown option, only the last job will shutdown"
echo " * Subtitles are always hard coded into the video stream"
echo
fi
Bookmarks