Page 1 of 1

Batch converting within sub-folders, Output to 1 seperate folder

Posted: Thu Aug 11, 2016 10:30 pm
by Discodools
After a while of using the queue in the gui I found this script for cli which searches and converts videos within sub folders and outputs to the source folders. Usage: handbrakefolder.sh /path/to/source/folder/

Code: Select all

 #!/bin/bash
#
# Change this to specify a different handbrake preset. You can list them by running: "HandBrakeCLI --preset-list"
#
PRESET="iPhone & iPod Touch"
if [ -z "$1" ] ; then
    TRANSCODEDIR="."
else
    TRANSCODEDIR="$1"
fi
    find "$TRANSCODEDIR"/* -type f -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 --preset="$PRESET"' __ {} \;
What I want it to do is to output to a common folder, I've tried a few things but I'm too unfamiliar with scripting to get it to work. Anyone?

Re: Batch converting within sub-folders, Output to 1 seperate folder

Posted: Wed Sep 14, 2016 7:37 pm
by Rocketcandy
Hi Discodools,

The Output part here: "${1%\.*}" is the original file name so all you should have to do is add the path to the front of that.

Like this:

Code: Select all

-o /some/path/here/"${1%\.*}".mp4
Let me know if that doesn't work :)