SurlyJake Blog

Script to Run Handbrake on an Entire Folder

| Comments

UPDATED 8-10-10: This script has been superceeded by its newer version at http://www.surlyjake.com/blog/2010/08/10/script-to-run-handbrake-recursively-through-a-folder-tree/. The new version features all of the previous features, but can also traverse recursively through a folder structure.

handbrake.sh
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
if [ -z "$1" ] ; then
    TRANSCODEDIR="."
else
    TRANSCODEDIR="$1"
fi
for file in "$TRANSCODEDIR"/*
do
    HandBrakeCLI -i "${file}" -o "${file}.mp4" --preset="iPhone & iPod Touch"""
done

Save that into a .sh file like “handbrakefolder.sh”

Comments