Where's the CLI and other questions
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.
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.
Where's the CLI and other questions
First question: I can't find the CLI in MacOS. Some code examples show it in a subdirectory to Handbrake (the GUI version), but on the Mac, Handbrake is a package that I put into Applications. When I look at the Package Contents, I don't see the CLI. Am I looking incorrectly? In the CLI documentation, there are hints that the CLI is DL'd separately, but I may be misinterpreting that, AND I don't see anyplace to DL the CLI for MacOS. Again, could be my error
PROBLEM STATEMENT: Ultimately what I'm trying to do is convert a bunch of WMVs to H264 MP4s with the same names (different extensions, of course) that are all in one folder. Using the GUI, I have to open one source at a time and then just hit Add to Queue. So much work.
So I want to use the CLI with wildcards, such as
HandbrakeCLI -i *.wmv --preset-import-gui -Z RK-WMV2MP4
Logically, this would process all files that have the WMV extension in the current directory (maybe I could say ./*.wmv). Since destination is not specified, the CLI simply uses the title of the input(s)--theoretically, this is in the indicated preset I imported from the GUI.
Should this work? Is there a way to do this through the GUI?
HandBrake version (e.g., 1.0.0): 1.6.X (latest)
Operating system and version : 13.5 Ventura
Thanks. BTW, I did a search for CLI on Mac to see if I could find where it's located, and I read the first three pages of CLI comments.
-normie-
PROBLEM STATEMENT: Ultimately what I'm trying to do is convert a bunch of WMVs to H264 MP4s with the same names (different extensions, of course) that are all in one folder. Using the GUI, I have to open one source at a time and then just hit Add to Queue. So much work.
So I want to use the CLI with wildcards, such as
HandbrakeCLI -i *.wmv --preset-import-gui -Z RK-WMV2MP4
Logically, this would process all files that have the WMV extension in the current directory (maybe I could say ./*.wmv). Since destination is not specified, the CLI simply uses the title of the input(s)--theoretically, this is in the indicated preset I imported from the GUI.
Should this work? Is there a way to do this through the GUI?
HandBrake version (e.g., 1.0.0): 1.6.X (latest)
Operating system and version : 13.5 Ventura
Thanks. BTW, I did a search for CLI on Mac to see if I could find where it's located, and I read the first three pages of CLI comments.
-normie-
Re: Where's the CLI and other questions
The CLI is a separate download, see the cli section on handbrake.fr Downloads page.
Re: Where's the CLI and other questions
No. HandBrakeCLI doesn't understand wildcards, and it doesn't have to, as the shell (e.g. bash or zsh) already has all the tools required and we're not going to re-invent the wheel.normie100 wrote: ↑Sat Jul 29, 2023 2:18 am So I want to use the CLI with wildcards, such as
HandbrakeCLI -i *.wmv --preset-import-gui -Z RK-WMV2MP4
Logically, this would process all files that have the WMV extension in the current directory (maybe I could say ./*.wmv). Since destination is not specified, the CLI simply uses the title of the input(s)--theoretically, this is in the indicated preset I imported from the GUI.
Should this work?
Code: Select all
for i in *.wmv; do /path/to/HandBrakeCLI --preset-import-gui -Z RK-WMV2MP4 -i "$i" -o "${i%.wmv}.mp4" 2> "${i%.wmv}.log.txt"; done
You can use HandBrakeCLI without the full path if it's in a folder that's in your PATH: https://en.wikipedia.org/wiki/PATH_(variable)
If it's in the same folder as the input, "./HandBrakeCLI" without quotes.
Redirection of standard error stream to a file: https://en.wikipedia.org/wiki/Redirecti ... le_handles
See "Substring Removal" section of https://tldp.org/LDP/abs/html/string-manipulation.html for how my example removes the .wmv extension and appends a new one.
-
- Veteran User
- Posts: 4859
- Joined: Wed May 04, 2011 11:06 pm
Re: Where's the CLI and other questions
Or just open the folder in the GUI
Re: Where's the CLI and other questions
This would be the magic I was looking for to use the GUI. Thanks tons. Having come from BAT files and unix wildcards, that was my first thought. I hope this works
-
- Veteran User
- Posts: 4859
- Joined: Wed May 04, 2011 11:06 pm
Re: Where's the CLI and other questions
@Rodeo
Thanks for teaching me how to fish. And it's nice to see that some of my assumed parameters were correct (i.e., getting the GUI preset).
Thanks for teaching me how to fish. And it's nice to see that some of my assumed parameters were correct (i.e., getting the GUI preset).
Re: Where's the CLI and other questions
Thanks for the pointer! Really drives home the usefulness of reading ALL of the documentation...
Re: Where's the CLI and other questions
TBH I didn't double-check, I copied it because it looked correct. If it doesn't work you'll at least have a log.txt file with hopefully some helpful message in it.
Re: Where's the CLI and other questions
But then you have to deal with the angry spaghetti.