17

I'm at a very long task at converting 800+ small files to mp4, and I'm using Handbrake at the moment. Its fast, but since there are many files, it takes a lot of time. I created a automator workflow for HandbrakeCLI so I can batch convert files in any folder. This works great, but I need it to work with a custom preset I have on the Handbrake GUI. Can I import the preset to CLI somehow? I'm not a Lunix or terminal wiz.

Cfinley
  • 1,435

4 Answers4

22

If you are working on the same machine and account as the GUI instance where you created the preset you can just select it with -z:

HandBrakeCLI -Z MyPreset -i inputfile.mpg -o outputfile.mp4

If you're trying to do it on another computer to where you set up the preset you will first need to export it from the GUI (in the presets menu) as a .plist file. Then you can import it (you need to do it every time, it doesn't save it) when you do the encode:

HandBrakeCLI --preset-import-file /path/to/preset.plist -Z "my preset" -i inputfile.mpg -o outputfile.mp4

It uses PresetName. The file name is only used for the purpose of opening the file, then it is forgotten and ignored.

If PresetName == "My Custom Preset" and file is "somepreset.json", the correct command line to use that preset is: HandBrakeCLI --preset-import-file somepreset.json -Z "My Custom Preset" ...

Majenko
  • 32,964
5

I found out how to create and use an exported JSON.

I used the GUI to create the JSON, then used the following command to reference it from the command line:

HandBrakeCLI -v --preset-import-file 20RF.json -i input.ts file name -o output.mp4

I had created some that did not work.. and for some reason one that did, after editing and renaming it did not work. When I followed the following process it did.

  1. Create presets wanted in GUI and save as new preset given your name of choice.

  2. Presets - set Default (this sets your new preset as the default... when I don't do this it does not work)

  3. Presets - Export (name your new .json file.. was 20RF.json in my above example.)

The HandBrakeCLI will open and use the setting in the json file when created this way. I am using HandBrake 1.1.0 (x86_64) with an i5 8400 and Ubuntu mate 18.04

This is one of the threads which pointed me in the right direction to find out what worked on my system so wanted to share back.

0

https://trac.handbrake.fr/roadmap lists this feature for a not yet completed release 1.0.

Maybe http://www.osomac.com/2011/05/05/handbrake-custom-presets/ could be of some help but seems to be OS X only.

Quartz
  • 11
-1

I just came across this and found an easy option in the latest version of the help file. Compare it four yourself:

# Default preset list
HandBrakeCLI --preset-list

Additionally load presets defined in the GUI

HandBrakeCLI --preset-list --preset-import-gui

If you are asking youself:

Well, using the path to a specific file is also fine, isn't it?

If you want to keep track of every location on every system that you will ever use, sure! On Ubuntu I might have a package from a repository, Flatpak, Snap, eventually Appimage. I'm certain there are different styles to install and use Handbranke on Mac and Windows. Use --preset-import-gui, it's nice and simple.