The process should work on any x86 based model.
You will need to get HandBrakeCLI (0.93 version required, not 0.94) installed and on your path before the script will work.
I got it from a Debian package, and manually extracted it (link below).
For it to work you create an 'Encode' folder (/share/Public/Encode in the script).
Inside this folder you create a folder for each set of encoding settings.
Each of these folders must contain a file called 'handbrake.profile'. There's an example below.
The script looks for any files with specific extensions, or VIDEO_TS folders within these 'profile' folders (and in any subfolders).
I use cron to run the script at midnight every day.
Code: Select all
# encode files in Encode folder with handbrake
# profile filename
# extension to use when we complete encoding a file
# flags that we are busy
# 1. check work file not present .... quit if it is
if [ -a $WORKFILE ];
echo "Encode already in progress ... exiting."
echo "Looking for files to encode ..."
# get list of directories to look in for video files / profiles
PROFDIRS=`find $ENCDIR -type d -name "*"`
for DIR in $PROFDIRS
if [ -a "$DIR/$PROFILE" ];
echo "$DIR has profile options : $OPTIONS"
# look for any file with specified extensions
VIDFILES1=`find $DIR -type f -name "*.ts"`
VIDFILES2=`find $DIR -type f -name "*.avi"`
VIDFILES3=`find $DIR -type f -name "*.mkv"`
VIDFILES4=`find $DIR -type f -name "*.m2ts"`
VIDFILES5=`find $DIR -type d -name "VIDEO_TS"`
VIDFILES6=`find $DIR -type f -name "*.mpg"`
VIDFILES7=`find $DIR -type f -name "*.wmv"`
# .. and so on, finally put them all together
VIDFILES="$VIDFILES1 $VIDFILES2 $VIDFILES3 $VIDFILES4 $VIDFILES5 $VIDFILES6 $VIDFILES7"
for VID in $VIDFILES
echo "Encoding video file $VID to file $OUTFILE"
# use HandBrakeCLI to encode the file
COMMAND="HandBrakeCLI -i $VID -o $OUTFILE -f mp4 -m -O $OPTIONS"
mv $VID $VID.$COMPEXT
echo "Completed and renamed to $VID.$COMPEXT."
echo "Completed encoding."
Here's an example Handbrake profile
Code: Select all
-e x264 -b 1200 -2 -T -E faac -B 160 -6 dlp2 --decomb --deblock -w 640