Mac CLI not able to open source?

HandBrake for Mac support
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
iCloud
Posts: 5
Joined: Sat Feb 18, 2023 3:53 am

Mac CLI not able to open source?

Post by iCloud »

Description of problem or question:

Cannot get CLI to encode video files that have punctuation in the file name.

Steps to reproduce the problem (If Applicable):

Code: Select all

/Applications/HandBrakeCLI -v --preset-import-gui -Z 'G 720x480 Apple 1080p30 Surround B - Test' -i "/Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv" -o "/Users/gmh/Movies/EMERGENCY/EMERGENCY_S1/EMERGENCY_S01E04_Cook\'s\ Tour.mp4"
Here is the file listing for the source directory.

Code: Select all

gmh@Garys-MacBook-Pro ~ % ls -l /Users/gmh/Movies/EMERGENCY/S1D2
total 15147120
-rw-rw-rw-@ 1 gmh  staff  2642913299 Feb  1 11:51 EMERGENCY_S01E04_Cook's Tour.mkv
-rw-rw-rw-@ 1 gmh  staff  2575475506 Feb  1 12:00 EMERGENCY_S01E05_Brushfire.mkv
-rw-rw-rw-@ 1 gmh  staff  2536929052 Feb  1 12:12 EMERGENCY_S01E06_Dealer's Wild.mkv
gmh@Garys-MacBook-Pro ~ % 
HandBrake version (e.g., 1.0.0):

1.6.1 (CLI Version)


Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

MacOS 13.2.1


HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

gmh@Garys-MacBook-Pro ~ % /Applications/HandBrakeCLI -v --preset-import-gui -Z 'G 720x480 Apple 1080p30 Surround B - Test' -i "/Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv" -o "/Users/gmh/Movies/EMERGENCY/EMERGENCY_S1/EMERGENCY_S01E04_Cook\'s\ Tour.mp4"

[17:31:30] Compile-time hardening features are enabled
[17:31:31] hb_init: starting libhb thread
[17:31:31] thread 700003390000 started ("libhb")
HandBrake 1.6.1 (2023012200) - Darwin x86_64 - https://handbrake.fr
8 CPUs detected
Opening /Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv...
[17:31:31] CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
[17:31:31]  - Intel microarchitecture Kaby Lake
[17:31:31]  - logical processor count: 8
[17:31:31] hb_scan: path=/Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv, title_index=1
disc.c:333: failed opening UDF image /Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv
disc.c:437: error opening file BDMV/index.bdmv
disc.c:437: error opening file BDMV/BACKUP/index.bdmv
[17:31:31] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't stat /Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv
No such file or directory
libdvdread: Could not open /Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv
libdvdnav: vm: failed to open/read the DVD
[17:31:31] dvd: not a dvd - trying as a stream/file instead
[17:31:31] hb_stream_open: open /Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E04_Cook\'s\ Tour.mkv failed
[17:31:31] scan: unrecognized file type
[17:31:31] libhb: scan thread found 0 valid title(s)
No title found.

HandBrake has exited.
iCloud
Posts: 5
Joined: Sat Feb 18, 2023 3:53 am

Re: Mac CLI not able to open source?

Post by iCloud »

Just for reference when trying to do another file I get the same error:

/Applications/HandBrakeCLI -v --preset-import-gui -Z 'G 720x480 Apple 1080p30 Surround B - Test' -i "/Users/gmh/Movies/EMERGENCY/S1D2/EMERGENCY_S01E06_Dealer\'s\ Wild.mkv" -o "/Users/gmh/Movies/EMERGENCY/EMERGENCY_S1/EMERGENCY_S01E06_Dealer\'s\ Wild.mp4"
Deleted User 11865

Re: Mac CLI not able to open source?

Post by Deleted User 11865 »

Your mistake, you cannot use double quotes and also specifically escape the single quotes. This is unrelated to HandBrake, BTW.

You can test whether you're passing a valid path to HandBrakeCLI (or any other command) by e.g. using the ls command:

Code: Select all

% ls "EMERGENCY_S01E04_Cook's Tour.mkv"
EMERGENCY_S01E04_Cook's Tour.mkv
% ls EMERGENCY_S01E04_Cook\'s\ Tour.mkv
EMERGENCY_S01E04_Cook's Tour.mkv
% ls "EMERGENCY_S01E04_Cook\'s\ Tour.mkv"
ls: EMERGENCY_S01E04_Cook\'s\ Tour.mkv: No such file or directory
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Mac CLI not able to open source?

Post by mduell »

You don't need to escape the path if you quote the path.
Post Reply