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

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
Discodools
Posts: 1
Joined: Thu Aug 11, 2016 10:21 pm

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

Post by Discodools » Thu Aug 11, 2016 10:30 pm

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?

Rocketcandy
Posts: 5
Joined: Wed Sep 14, 2016 4:24 pm

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

Post by Rocketcandy » Wed Sep 14, 2016 7:37 pm

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 :)

Post Reply