I wrote this batch script to encode all videos recursively from a start directory. This for small videos recorded from various different mobiles; with the aim to reduce file sizes:
Code: Select all
#!/bin/bash
export FLAGS="
--format mkv
--decomb=bob
--loose-anamorphic
--two-pass
--modulus 2
--encoder x264
--x264-preset veryslow
--quality 17
--aencoder copy
--audio-fallback ac3
--encoder-preset slow
--optimize"
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
TRANSCODEDIR="$1"
fi
find "$TRANSCODEDIR"/* \
-type f \
-iregex '.*\.\(avi\|mpg\|flv\|wmv\|mov\|3gp\|mp4\)$' \
-exec bash \
-c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mkv $FLAGS' __ {} \;
Any tips/advice very welcome.