Using Handbrake CLI with existing preset

HandBrake for Mac support
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
exod
Posts: 42
Joined: Fri Aug 29, 2014 7:41 pm

Using Handbrake CLI with existing preset

Post by exod »

Description of problem or question:
- was looking at this https://handbrake.fr/docs/en/latest/cli ... tions.html
- using this command HandBrakeCLI -i source -o destination

it says That will encode with default “Normal” Preset.

How do I specify the preset I desire to use.


Steps to reproduce the problem (If Applicable):




HandBrake version (e.g., 1.0.0):
Version 1.3.3 (2020061300)



Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
10.15.7



HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

Please replace this text with the contents of your log file between the two code tags - OR -  provide a pastebin URL in place of these 3 lines.
If you are unable to do so, please state why so we can help you.
exod
Posts: 42
Joined: Fri Aug 29, 2014 7:41 pm

Re: Using Handbrake CLI with existing preset

Post by exod »

would it be this: HandBrakeCLI -Z MyPreset -i inputfile.mpg -o outputfile.mp4
User avatar
JohnAStebbins
HandBrake Team
Posts: 5639
Joined: Sat Feb 09, 2008 7:21 pm

Re: Using Handbrake CLI with existing preset

Post by JohnAStebbins »

Full list of HandBrakeCLI options is here https://handbrake.fr/docs/en/latest/cli ... rence.html
Woodstock
Veteran User
Posts: 4326
Joined: Tue Aug 27, 2013 6:39 am

Re: Using Handbrake CLI with existing preset

Post by Woodstock »

Before you choose a preset, you have to load it. If the preset is saved in the GUI, you have to include --preset-import-gui in your command line. If it is saved in a file, you would use --preset-import-file <filespec> (where <filespec> is the path to the file with the presets in it).

Think of it as telling the CLI where the library is, THEN the name of the book you want.
exod
Posts: 42
Joined: Fri Aug 29, 2014 7:41 pm

Re: Using Handbrake CLI with existing preset

Post by exod »

so the full command would be:

Code: Select all

handbrakecli -Z MyPreset -i inputfile.mpg -o outputfile.mp4 --preset-import-file /Library/Containers/fr.handbrake.HandBrake/Data/Library/Application Support/HandBrake/UserPresets.json
User avatar
Rodeo
HandBrake Team
Posts: 12872
Joined: Tue Mar 03, 2009 8:55 pm

Re: Using Handbrake CLI with existing preset

Post by Rodeo »

Except if the preset you want is a GUI preset, --preset-import-gui essentially does the same as --preset-import-file <path/to/gui/presets/file>
exod
Posts: 42
Joined: Fri Aug 29, 2014 7:41 pm

Re: Using Handbrake CLI with existing preset

Post by exod »

So this would be the final command?

Code: Select all

handbrakecli -Z NameMyPreset -i inputfile.mpg -o outputfile.mp4 --preset-import-gui 
User avatar
Rodeo
HandBrake Team
Posts: 12872
Joined: Tue Mar 03, 2009 8:55 pm

Re: Using Handbrake CLI with existing preset

Post by Rodeo »

Yes. It probably won't make a difference, but just to be safe, I would place --preset-import-gui before -Z presetname :-)
exod
Posts: 42
Joined: Fri Aug 29, 2014 7:41 pm

Re: Using Handbrake CLI with existing preset

Post by exod »

thank you! will do.

Code: Select all

handbrakecli -i inputfile.mpg -o outputfile.mp4 --preset-import-gui -Z NameMyPreset
Post Reply