Skip to content

Instantly share code, notes, and snippets.

@sadlerjw
Created August 5, 2013 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadlerjw/6159489 to your computer and use it in GitHub Desktop.
Save sadlerjw/6159489 to your computer and use it in GitHub Desktop.
Shell script to do batch encoding using HandBrakeCLI. Automatically invokes HandBrakeCLI on each file passed in (you can also use BASH wildcards) and creates a new .m4v file (if one doesn't already exist). My script uses the "AppleTV 2" preset - just modify the script to use a different one.
#!/bin/bash
for f in "${@}"
do
if [ ! -f "${f%.*}.m4v" ]; then
HandBrakeCLI --preset="AppleTV 2" -i "$f" -o "${f%.*}.m4v"
else
echo "Skpping $f - already exists: ${f%.*}.m4v"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment