Welcome to FreeSoftwareServers Confluence Wiki

Place handbrake.script into /media/handbrake.script (Ported from here)

Un-comment the line you wish to use and the file type. You can add many more "presets/FLAGS", this is just an idea.

Handbrake.script Contents:


#Uncomment a Preset FLAGS and Uncomment a file type (mkv,avi,mp4)!

# This Script Goes in Root Folder of TV show -- Example Folder Structure
# /Stargate/Season\ 1/Epiosde.avi
# /Stargate/Season\ 2/Epiosde.avi
# /Stargate/handbrake.script
# Outputs all Files back inside same dir's and does all folders inside Startgate DIR
# /Stargate/Season\ 1/Epiosde.mp4
# /Stargate/Season\ 2/Epiosde.mp4

# FLAGS = flags for CLI can be got from GUI under Activity Log or from https://trac.handbrake.fr/wiki/CLIGuide OR you can use actual Presets! (Flags can not have spaces, IE: No Presets, and cant have (quotes)'s, but you can just delete them, like --decomb="bob", the CLI accepts --decomb=bob

###Encode AC3 5.1

#export FLAGS="-f mp4 -O --decomb=bob --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E ac3 -6 5point1 -R 48 -B 448 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"

###COPY AC3 5.1

#export FLAGS="-f mp4 -O --decomb=bob --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E copy:ac3 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"

###Denoise & Encode AC3 5.1

#export FLAGS="-f mp4 -O --decomb=bob --nlmeans=medium --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E ac3 -6 5point1 -R 48 -B 448 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"

###Denoise & COPY AC3 5.1

#export FLAGS="-f mp4 -O --decomb=bob --nlmeans=medium --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E copy:ac3 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"

if [ -z "$1" ] ; then
	###To use [&& find . -name '*.***' -exec rm -r {} \;] Uncomment and delete once to add to previous line of code
        ###Removes source files after completing ALL conversions. Use at your own risk!

    #find "$TRANSCODEDIR"/* -type f -name "*.avi" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 $FLAGS' __ {} \; 
#&& find . -name '*.avi' -delete

    #find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 $FLAGS' __ {} \; 
#&& find . -name '*.mkv' -exec rm -r {} \;

    #find "$TRANSCODEDIR"/* -type f -name "*.mp4" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}"-new.mp4 $FLAGS' __ {} \; 
#&&find . -type f -not -name '*FINAL.mp4' -name '*.mp4' -delete && rename 's/FINAL//' *.mp4

I Used the windows program *Note that latest Nightly does not output CLI flags and I don't think newer versions will so I use 0.10.2* and tested till I found my perfect settings then run it on a file and click activity window >> encode log >> (AT BEGINNING OF LOG) this is what I got.

Note: HandbrakeCLI CLI Flags WIKI

CLI Query:  -i "C:\Users\donut\Downloads\TobeConverted\Love & Other Drugs (2010).avi" -t 1 --angle 1 -c 1 -o "C:\Users\donut\Downloads\ConvertedMedia\Love & Other Drugs (2010).mp4"  -f mp4  -w 720 --crop 68:70:0:0 --loose-anamorphic  --modulus 2 -e x264 -q 20 --vfr -a 1 -E ac3 -6 5point1 -R Auto -B 384 -D 0 --gain 0 --audio-fallback ac3 --markers="C:\Users\donut\AppData\Local\Temp\Love & Other Drugs (2010)-1-chapters.csv" --encoder-preset=veryfast  --encoder-level="5.2"  --encoder-profile=high  --verbose=1

Remove unwanted stuff and convert for variable FLAGS

The simple version is

HandBrakeCLI -i source [flags] -o destination [flags] 

So I had to remove

--markers="C:\Users\donut\AppData\Local\Temp\Love & Other Drugs (2010)-1-chapters.csv" 

Configure Alias to be used at bottom of directory(s) to be converted recursively.

sudo nano ~/.bashrc && sudo source ~/.bashrc 
alias handfolder="sudo cp /media/handbrake.script ./ && sudo nano ./handbrake.script ; nohup ./handbrake.script > convert.nohup &" 


  • No labels

1 Comment