Skip to content

Instantly share code, notes, and snippets.

@jbfink
Forked from halbtuerke/handbrake-batch.sh
Last active December 10, 2015 16:58
Show Gist options
  • Save jbfink/4464616 to your computer and use it in GitHub Desktop.
Save jbfink/4464616 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This script converts any kind of video the HandBrake CLI can handle
# into a 1000 kbit MPEG4 video and shrinks it down to a max width of 640 px.
#
# Usage:
# Running the script without any parameters just uses *all* files in the
# current directory and converts them, so make sure you only have video files
# in the directory you're in.
#
# You can specify an input and output directory if you want:
# 'script <INPUT> <OUTPUT>'
#
# The script also assumes you're using Mac OS X and have 'Growl' and 'growlnotify'
# installed, if you don't then just comment out the last line.
if [ ! -n "$1" ]; then
IN='.'
OUT='.'
else
IN=$1
OUT=$2
fi
cd "$IN"
for InputItem in *;do
/usr/bin/HandBrakeCLI -Z Normal -i "$InputItem" -o "$OUT/${InputItem}.mkv"
done
#growlnotify "Conversion done" -m 'Have fun with your new files' -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment