15

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
  • 3
  • 14
  • 20
user2059370
  • 251
  • 1
  • 2
  • 4

3 Answers3

19

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,128
  • 4
  • 61
  • 81
  • 1
    at least with OSX 20160707 nightly this doesnt behave quite as advertised - -Z is only for built-in presets. and the import options (--preset-import-file and --preset-import-gui) dont successfully work with an exported preset (.json) from the gui. and instead of failing, they default to x264/rf22.... – keen Jul 12 '16 at 02:53
  • HandBrakeCLI-20160707231111-0fc54d0 --preset-import-file ~/Library/Application\ Support/HandBrake/UserPresets.json -Z 'MY-CUSTOM-PRESET' -i input.mkv -o output.mkv however seems to be working - consuming the userpresets file from the gui, and specifying the specific preset in that. – keen Jul 12 '16 at 02:54
  • HandBrakeCLI-20160707231111-0fc54d0 --preset-import-file my-custom-preset-export.json -Z 'MY-CUSTOM-PRESET' -i input.mkv -o output.mkv - also works. note that I specified the file I exported the preset too AND the name of the preset. – keen Jul 12 '16 at 02:56
  • `--preset-import-gui` works to import custom presets from the GUI version of Handbrake, if one is installed – Manny Fleurmond Sep 12 '22 at 00:23
2

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.

  • 2
    This kinda helped me. However, the "Set default" step is not necessary if you also select the preset via the `--preset` option. Example: `--preset-import-file "70s.json" --preset "70s"` – Chuck Jan 30 '21 at 17:55
  • works like hell – Sid Jan 17 '23 at 23:53
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