Generate CLI options from GUI options?

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.
fbacher
Posts: 4
Joined: Tue Jan 26, 2010 4:28 pm

Generate CLI options from GUI options?

Post by fbacher »

I am running on Ubuntu. I don't have version info on me here at work, but it should be recent.

I have been using the HandBrake gui for some time now and I create a preset with the options I love and made it my default. Now I need to use the CLI. So far I don't see an easy way to reuse the options I have in the GUI. I hope that I am proven stupid for not seeing the obvious.

Ideally the CLI would see any presets that I created in the GUI. But I don't see such a feature.

Barring that, it would be great to cut and paste the options from the GUI into a script where I could modify and quote them properly for the cli. This seems to be done for the Picture options, but I don't see where ALL (command line) options are visible in the GUI. I swear I saw where I saw all of the command line style options show up in the GUI, but I don't see it now. Perhaps a different version? Perhaps on my Windows box?

So far it looks like I will have to manually look up the CLI options for each checkbox that I made in the GUI. I can do this, but it is ugly.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Generate CLI options from GUI options?

Post by mduell »

The Windows GUI has to generate the CLI string, since the actual encoding isn't integrated into the Windows GUI.

The Linux GUI has the encoding parts integrated, so it doesn't have to generate the CLI string.

But if you're on Linux and can use a CLI, reading --help for the options you want is a pretty low bar.
fbacher
Posts: 4
Joined: Tue Jan 26, 2010 4:28 pm

Re: Generate CLI options from GUI options?

Post by fbacher »

Yes, I realize that I can get the help on the cli and then go back and look at what I checked in the gui and pray that the wording is similar for the description of the same things and that I get the order of the options and the quoting, etc. are all correct. But it seems that all of that seems a bit silly when it can easily be produced by the program itself.

I have worked with many programmers over the years. There are some that like to say "kiss" Keep it simple, stupid. But I wonder who they are keeping it simple for. Don't get me wrong. Handbrake is wonderful. It is free to me and very costly to those who develop it. I am grateful. But it seems that a little polish can make things more attractive, less error prone and easier to use.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Generate CLI options from GUI options?

Post by mduell »

fbacher wrote:Yes, I realize that I can get the help on the cli and then go back and look at what I checked in the gui and pray that the wording is similar for the description of the same things and that I get the order of the options and the quoting, etc. are all correct. But it seems that all of that seems a bit silly when it can easily be produced by the program itself.

I have worked with many programmers over the years. There are some that like to say "kiss" Keep it simple, stupid. But I wonder who they are keeping it simple for. Don't get me wrong. Handbrake is wonderful. It is free to me and very costly to those who develop it. I am grateful. But it seems that a little polish can make things more attractive, less error prone and easier to use.
You could pray, or you could read the activity logs to verify you've selected the same settings. The relevant portion of the activity log, job configuration, is only about two dozen lines long. The order doesn't matter.

The string can't easily be produced by the program itself. The GUI is not producing it and secretly hiding it. Also quoting may vary based on the user's selection of shell. So you have scare resources (developer time, developer interest) to allocate against a feature of marginal utility.

This isn't a little polish, this is an obscure feature request for a niche group of users who are generally well equipped to handle the task on their own.

But of course, patches welcome if you'd like to develop and support the feature on an ongoing basis.
ty2010
Novice
Posts: 72
Joined: Mon Feb 18, 2013 7:09 am

Re: Generate CLI options from GUI options?

Post by ty2010 »

Use the GUI, add to queue, on the queue page generate batch script.
tc60045
Posts: 24
Joined: Sun Apr 22, 2007 8:59 pm

Re: Generate CLI options from GUI options?

Post by tc60045 »

mduell wrote:This isn't a little polish, this is an obscure feature request for a niche group of users who are generally well equipped to handle the task on their own.
Funny, I have spent a good 4 hours of elapsed time today trying to get CLI to replicate something easily done in MacGui, and longed for the same feature as did the OP -- I actually mis-recalled that the x264 string options were generated by the GUI, only to then realize they were x264 options and not CLI options. OP, consider this a +1, but...

The biggest difference is that the GUI version scans the source first and you then select options based on what it has already found; the CLI has to be told to look for things and then, having found them, take actions. CLI works smashingly well, but often you have to work around its limitations -- for example, if you have a foreign movie, you can rip that into sourcefolder2, which has different settings (subs or dubs - your preference) than sourcefolder1, reflected in your command / scripts.

So, OP, as a guy who sympathizes, what are you trying to do? Expound and I'll help you with the command.

TC
bsy-web
Posts: 7
Joined: Wed May 08, 2013 5:46 am

Re: Generate CLI options from GUI options?

Post by bsy-web »

I was also looking for exact same feature from GUI. I am comfortable with command line and always look through details of options, but being able to visually and rapidly build a queue of tasks avails best of both worlds. Essentially Handbrake is not a front-end for HandbrakeCLI and it sounds like that is not a trivial request.

Those (of us) using a network to parallel encode would be able to use GUI for generating tasks, and command line output to start them on available machines.
ty2010 wrote:Use the GUI, add to queue, on the queue page generate batch script.
I understand this suggestion as Presets -> Export... Then pass .plist file as argument to a script which parses the file and generates the appropriate command line arguments. In future, that would be great option:

Code: Select all

HandBrakeCLI --plist fromgui.plist

Where does the code for parsing a .plist preset file live for HandeBrake (GUI)?
Last edited by bsy-web on Fri May 10, 2013 5:06 am, edited 1 time in total.
Deleted User 11865

Re: Generate CLI options from GUI options?

Post by Deleted User 11865 »

bsy-web wrote:Where does the code for parsing a .plist preset file live for HandeBrake (GUI)?
Each UI has its own implementation.
bilgames
Posts: 1
Joined: Wed Jul 17, 2013 1:01 am

Re: Generate CLI options from GUI options?

Post by bilgames »

Not sure if you found out the answer. It took me a few days of reading a lot of forums it seems. Sadly, the answer is in the using the HandbrakeCLI guide which I overlooked as I was looking specifically for the ATV3 options and the guide hasn't been updated to include this yet. The preset and options are on HBCLI.

Just open a Terminal window, navigate to the folder containing HandbrakeCLI and type

Code: Select all

HandbrakeCLI -z
(alternatively, you can type)

Code: Select all

HandbrakeCLI --preset-list
This will give a list of all the available built-in presets and their options.
TJJ
Posts: 2
Joined: Mon Aug 12, 2013 6:45 pm

Re: Generate CLI options from GUI options?

Post by TJJ »

Registered on the forums just to add my +1 to this.

Such a lack of interoperability between the cli & gui components of handbrake seems perverse, especially with the gui already having the capability to export .plists .

Incidentally, my motivation for this feature is the same as bsy-web's; distributed encoding.
I want to use the gui to work out my config, and then the cli to be able to easily script distributed encoding across my network.

If HandBrake was written in a language I was familiar with, I'd happily do it myself.
However, it looks like it's a jumbled mess of multiple languages (none of which I'm fluent in), with platform specific gui implementations [yuck].
Next time, keep the decoding/encoding in C, and the gui in something platform independent & well supported. (My suggestion would be Java)

Still, a great tool :D
Use the GUI, add to queue, on the queue page generate batch script.
What version of Handbrake has that option?
0.99 (Windows) doesn't seem to.
Deleted User 11865

Re: Generate CLI options from GUI options?

Post by Deleted User 11865 »

TJJ wrote:Registered on the forums just to add my +1 to this.

Such a lack of interoperability between the cli & gui components of handbrake seems perverse, especially with the gui already having the capability to export .plists .
Translating GUI settings to CLI ones is a fair bit of work - time which is better spent making the Windows UI use libhb directly, like its Linux and Mac counterparts.
TJJ wrote:If HandBrake was written in a language I was familiar with, I'd happily do it myself.
However, it looks like it's a jumbled mess of multiple languages (none of which I'm fluent in), with platform specific gui implementations [yuck].
Next time, keep the decoding/encoding in C, and the gui in something platform independent & well supported. (My suggestion would be Java)
Yuck. At the very least, Mac users would hate that. Cross-platform GUI toolkits are great to build interfaces that look out-of-place on every platform. Looking and behaving almost like a native app doesn't quite cut it.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Generate CLI options from GUI options?

Post by mduell »

TJJ wrote:Incidentally, my motivation for this feature is the same as bsy-web's; distributed encoding.
I want to use the gui to work out my config, and then the cli to be able to easily script distributed encoding across my network.
The overlap of users who can do their own distributed encoding mechanism and would have a hard time figuring out their config with the CLI seems small.
TJJ
Posts: 2
Joined: Mon Aug 12, 2013 6:45 pm

Re: Generate CLI options from GUI options?

Post by TJJ »

mduell wrote:
TJJ wrote:Incidentally, my motivation for this feature is the same as bsy-web's; distributed encoding.
I want to use the gui to work out my config, and then the cli to be able to easily script distributed encoding across my network.
The overlap of users who can do their own distributed encoding mechanism and would have a hard time figuring out their config with the CLI seems small.
I'd argue quite the opposite.
Everyone has piles of idle computers nowadays, and distributing the execution of a sequence of command-line scripts across a cluster of machines is trivially simple.

Encoding on the other hand is a black art that few have the time to put into learning the intricacies of.

That's what makes the Handbrake GUI so useful; with no prior knowledge I can Google "handbrake Roku" (for example), and have all I need to generate suitable encodes.

On the other hand documentation explaining how Handbrake's GUI settings map to their command-line counterparts is (as far as I can tell) non-existent.
This lack of documentation is understandable, as it should be a completely automatable process - hence the existence of this thread.
yetiszaf
Posts: 1
Joined: Fri Aug 30, 2013 7:31 am

Re: Generate CLI options from GUI options?

Post by yetiszaf »

Even if you're not doing distributed encoding, having the ability to at least export the preset into something the CLI understands would be really cool, even if it is only the command-line. It took me quite some time to figure out how I want my videos encoded, getting all those presets right a second time is not something I am looking forward to.

I tried using the GUI for this. Problem is: I have to set up the language-order and title for every single Video. Which is not really what you want to do when encoding old TV-Series you just bought on 14 DVDs.

Being able to throw the CLI after this would make this really way easier, especially when running the encoder on a headless machine.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Generate CLI options from GUI options?

Post by Woodstock »

I stopped updating the GUI after the June 2012 nightlies because it stopped being able to generate a batch file. The GUI also had the defaults changed to ALWAYS burn in subtitles, whether you were dealing with DVD or BD sources, because that was the only way to put a PGS subtitle into an MP4 container.

For my usage, if there is more than one title on a disk that I want to rip (and most of my stuff is 4 to 9 episodes per disk), I pretty much have to use the CLI and a batch file, because it takes too long to configure the GUI.
DavidG
Posts: 4
Joined: Sat Jul 13, 2013 6:26 pm

Re: Generate CLI options from GUI options?

Post by DavidG »

yetiszaf wrote:especially when running the encoder on a headless machine.
I've been fighting with trying to get the CLI command on a headless server to do the same thing as the GUI for a few days. Countless rounds of RTFM, tweak, try, doesn't work, do it again, etc etc.

Found this thread -- glad I'm not alone!

It's a head-scratcher why given that .plists are exportable from the GUI, they're not usable in the CLI.

I'd be doing this all the time if I could figure out how to do it easily enough without having to 'wrestle' with interpreting/translating "two dozen lines" of ActivityLogs ...
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Generate CLI options from GUI options?

Post by s55 »

The GUI also had the defaults changed to ALWAYS burn in subtitles, whether you were dealing with DVD or BD sources, because that was the only way to put a PGS subtitle into an MP4 container.
Only PGS should be burned in by default and that's because the MP4 File format doesn't support it. It's not a HandBrake thing. Vobsubs are not burned in by default with mp4


The simple fact is, The Linux and Mac GUI's access libhb directly, so a query is never generated. A Query generator and all the logic that goes with it is a fair bit of work. No-one has shown any interest in developing this so it 's unlikely to happen.

The CLI doesn't support user presets because again, there is no interested developers. Ideally I'd like to see some of the preset handling stuff moved into libhb but I doubt it'll happen anytime soon, if ever.


Given that only a tiny fraction of users even download the CLI your never going to see much interest in this interface.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Generate CLI options from GUI options?

Post by Woodstock »

s55 wrote:Only PGS should be burned in by default and that's because the MP4 File format doesn't support it. It's not a HandBrake thing. Vobsubs are not burned in by default with mp4
The last several nightly build versions of the GUI that supported PGS and exporting a batch file default to burning in ALL forms of subtitles, when using the "High profile" defaults. It would actually try to burn in multiple subtitle tracks if you didn't watch it, only warning you about multiple tracks if those tracks were PGS. Fixes to this bug put in after the GUI lost its batch export are of little use to me.
Given that only a tiny fraction of users even download the CLI your never going to see much interest in this interface.
Back in the bad old days of 2012, you got the CLI if you downloaded the GUI, not via a separate, trackable download. By the time it was necessary to download it separately, the REASONS to download it went away, for those of us who use both. The GUI is too hard to use for more than a few files at a time, but it sure is pretty and easy to use for those one-title disks out there.

Seems like a "forced death spiral" to me. CLI support is limited because the developers got bored with it. Because it isn't supported, no one downloads it. Since no one downloads it, no one wants to support it anymore.

I guess the "problem" is really the change of philosophy. The GUI->CLI interface was a necessity before, and it had some benefits as well as liabilities. As soon as it was figured out how to do things without needing the CLI, the benefits of keeping an interface to the CLI were ignored.

Of course, it's all forced me to learn enough about the CLI to write the batch files manually. Writing an import file for the GUI to handle a 200- or 300-file conversion is ridiculous, and I've tried it.
jelabarre59
Posts: 6
Joined: Fri Mar 28, 2014 1:26 am

Re: Generate CLI options from GUI options?

Post by jelabarre59 »

I have to put in a request for showing the command line options as well. The idea is to fiddle with the settings in the GUI for one file in a batch, then once you have it worked out you'd take the command options and sumply feed the rest of the files from a script (or just feed a batch of files in sequence). Come on now, even something as backwards and obsolete as "smit" on IBM's AIX can do it. So why not Handbrake?
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Generate CLI options from GUI options?

Post by Woodstock »

I think the best we could hope for is a translator to parse a GUI queue file and generate the equivalent command line.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Generate CLI options from GUI options?

Post by s55 »

@jelaarre59 -> Mac and Linux GUI's never interact with the CLI, so never generate a CLI query. They interact directly with libhb. WinGui currently interacts with encode only, scan is via libhb now. Encode may be in the future too. Until that happens, encode cli query is still printed in the log viewer.

@woodstock -> Queue file format is different for each platform, so not really a practical solution.
jelabarre59
Posts: 6
Joined: Fri Mar 28, 2014 1:26 am

Re: Generate CLI options from GUI options?

Post by jelabarre59 »

@s55:
the log viewer on **WHICH** platform???? I am running Linux, which would usually be the platform that would provide more useful information. And the "queue" screen does not provide the command options in a recognizable format that could in turn be used on the command line. If the CLI is going away, I will just have to find a different tool.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Generate CLI options from GUI options?

Post by s55 »

The CLI is not going away. It will always be available.

The Linux GUI simply doesn't use it at all. It's using the handbrake library instead, so it never has to generate a CLI query. It's using HandBrake's own internal data structures. To add support for showing the CLI query, is actually a lot of work as you have to go fetch the status of every widget and setting to build it up.

Only the Windows GUI interacts with the CLI (although not for much longer)
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Generate CLI options from GUI options?

Post by Woodstock »

s55 wrote:@woodstock -> Queue file format is different for each platform, so not really a practical solution.
Do I have to point out that this is a less-than-intelligent design choice? There are other terms that could be used, but many would find them insulting.

Using XML, which the queue files I have seen use, to describe the queue should make it SIMPLE to address the "all the widgets" issue. And you could build a queue on one platform where you like the particular interface, and hand it off to any other platform for actual execution.

I can see different UIs being written by different groups having differences in functionality, but, if the encoding engine itself is supposed to be platform-agnostic, the queue that drives it should be the same across all platforms, too.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Generate CLI options from GUI options?

Post by mduell »

The queues are just a part of the GUI, not the core engine (libhb). Thus the implementation specific differences make sense.

The loose coupling of the GUIs makes sense for a small volunteer project.

And as always, patches welcome.
Post Reply