Using HandbrakeCLI and Scripts

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
DeltaDc12
Posts: 6
Joined: Mon Jun 06, 2011 10:25 pm

Using HandbrakeCLI and Scripts

Post by DeltaDc12 » Mon Feb 25, 2019 2:04 am

HandBrake-1.2.2-x86_64-Win_GUI
HandBrakeCLI-1.2.2-win-x86_64
Windows 10 Pro

I'm trying to use a GUI exported custom preset "720p HD Subs.json" with HBCLI and a Script to process my HDHomeRun recorded Tv shows recorded by Plex.

Here's my script I'm trying to test.

"C:\Program Files\Handbrake\HandBrakeCLI.exe" -v -i "%%G" -o "%%~dG%%~pG%%~nG.mkv" --preset-import-file "D:\Plex\720p HD Subs.json" -Z "720p HD Subs"

Full script Below:
https://pastebin.com/pe0m2GJM

-------------------------------
Here's my 720p HD Subs.jason

https://pastebin.com/1eY0vziz
-----------------------------------------------
Here is the error I get when running the CLI for a test with custom preset I created.

"C:\Program Files\Handbrake\HandBrakeCLI.exe" -v -i "D:\Temp\Premier League Soccer (2011) - 2019-02-23 11 30 00 - Leicester City FC vs. Crystal Palace FC.ts" -o "D:\Temp\Premier League Soccer (2011) - 2019-02-23 11 30 00 - Leicester City FC vs. Crystal Palace FC.mkv" --preset-import-file "D:\Plex\720p HD Subs.json" -Z "720p HD Subs"

[19:43:08] hb_parse_filter_settings: Error parsing (0:0)
ERROR: Preset (null): Incorrect value type for key AudioDitherMethod. Converting.
ERROR: Invalid rotate filter settings (0:0)
Failed to initialize job

HandBrake has exited.

Full run in link below:
https://pastebin.com/Xfpwv2La
-------------------------------------------------------

I've been trying to work on this for a few days and haven't had any luck figuring out what's causing the error. HanbrakeCLI and script seem to be pulling in the correct .ts file and executing the "720p HD Subs" and fails. Any help or suggestions would be great. If you need anything else, Please let me know.






https://pastebin.com/tQPTWkPQ

User avatar
JohnAStebbins
HandBrake Team
Posts: 5440
Joined: Sat Feb 09, 2008 7:21 pm

Re: Using HandbrakeCLI and Scripts

Post by JohnAStebbins » Mon Feb 25, 2019 4:29 pm

Did you use the current 1.2.2 GUI to generate the preset? If so, it looks like there are a couple of bugs in it's preset export. It is failing to export AudioDitherMethod. This is ok since it's just falling back to the default, but if you want to silence the warning, add

Code: Select all

                "AudioDitherMethod": "auto",
to your audio settings in the preset file.

The other bug causes the failure to initialize. The format of the rotate filter settings is incorrect. Should be

Code: Select all

        "PictureRotate": "angle=0:hflip=0",
If you have a github account or would like to create one, this would be a good one to add to our issues list
https://github.com/HandBrake/HandBrake/issues

DeltaDc12
Posts: 6
Joined: Mon Jun 06, 2011 10:25 pm

Re: Using HandbrakeCLI and Scripts

Post by DeltaDc12 » Tue Feb 26, 2019 1:04 am

Thanks, I'll give that a try. Before I posted, I had deleted my preset and uninstalled Hb. Reinstalled and made a new export. Still didn't have any luck. I will let you know shortly.

Dc

Update: It WORKED.. Thank you very much!! The only errors were:

Encoding: task 1 of 1, 0.04 %[19:17:57] sync: first pts subtitle 0x0 is 24423
Encoding: task 1 of 1, 26.96 % (53.50 fps, avg 53.64 fps, ETA 00h02m32s)[ac3 @ 0000000006087040] expacc 125 is out-of-range
[ac3 @ 0000000006087040] error decoding the audio block
[ac3 @ 000000000410eb40] expacc 125 is out-of-range
[ac3 @ 000000000410eb40] error decoding the audio block

It's about half the size and looks great!! 5.1

I would have never found that.
Again, Thanks.

ChrisMc9
Posts: 3
Joined: Thu Mar 28, 2019 1:04 am

Re: Using HandbrakeCLI and Scripts

Post by ChrisMc9 » Thu Mar 28, 2019 1:21 am

I'm very new to this, so apologize for any stupid comments.

I also had this issue. I exported my json directly from the GUI but received an error when using:
HandBrakeCLI.exe --preset-import-file "C:\H265_preset.json" --preset=H265 -i "file1" -o "file2"

[20:45:11] hb_parse_filter_settings: Error parsing (0:0)
ERROR: Invalid rotate filter settings (0:0)

Changing it as described above worked perfectly! Thanks, John A Stebbins!

If I instead try to import the GUI settings themselves, I get even more errors. Any thoughts on those? For now I'm going to use the json. Is there a bug logger? I'd be happy to add.

[20:27:45] Preset (null): Incorrect value type for key AudioDitherMethod. Converting.
[20:27:45] Preset H265: Incorrect value type for key PictureDeinterlaceCustom. Converting.
[20:27:45] Preset H265: Incorrect value type for key PictureWidth. Converting.
[20:27:45] Preset H265: Incorrect value type for key PictureHeight. Converting.
[20:27:45] Preset H265: Incorrect value type for key PresetDescription. Converting.

mduell
Veteran User
Posts: 6622
Joined: Sat Apr 21, 2007 8:54 pm

Re: Using HandbrakeCLI and Scripts

Post by mduell » Thu Mar 28, 2019 2:50 am

Which GUI version? Which CLI version?

ChrisMc9
Posts: 3
Joined: Thu Mar 28, 2019 1:04 am

Re: Using HandbrakeCLI and Scripts

Post by ChrisMc9 » Thu Mar 28, 2019 2:53 am

They seem to be the same.

GUI version 1.2.2 (2019022300)
CLI --version
[22:53:00] hb_init: starting libhb thread
[22:53:00] thread 41670c0 started ("libhb")
HandBrake 1.2.2

ChrisMc9
Posts: 3
Joined: Thu Mar 28, 2019 1:04 am

Re: Using HandbrakeCLI and Scripts

Post by ChrisMc9 » Thu Mar 28, 2019 2:54 am

Oh, and the command I was using for the GUI settings was

C:\Program Files\HandBrake>HandBrakeCLI.exe --preset-import-gui --preset-list

Post Reply