So, I'm fairly new to HandbrakeCLI format and batch files, though I'm fairly experienced with coding in general. I have a bunch of TV shows that I would like to batch convert, and I thought that a batch file paired with HandbrakeCLI would be perfect. However, I'm being hit with an absolute mountain of errors. To start, here is my batch file script:
Code: Select all
FOR /F %%F IN ("%CD%") DO ( "C:\Program Files\Handbrake\HandBrakeCLI.exe" --preset-import-file "C:\Program Files\HandBrake\PresetList\presets.json" -Z "DS9 BTS" -i "%%F" -o "converted\%%F" -s "2" -S "English" )
1) Iterate through all the files in the directory of the .bat file
2) For each file in the directory, run Handbrake with my custom preset, imported from a JSON (since for some reason Handbrake wasn't recognizing it, even though it is on the same computer), with the 2nd subtitle track and renaming it to English.
However, it does NOT do that at all.
First off, the current directory's path is "R:\Content\Star Trek\Shows\Deep Space Nine\Season 4\2 - Bonus Features", which should be grabbed by the %CD%. However, when the batch file tries to use it, it shows in CommandPrompt as "R:\Content\Star," meaning it is only grabbing the directory path up to the first space, even though I have enclosed it in double quotes. And since this isn't a valid directory, it breaks everything. It just errors out, says "No title found" and then "HandBrake has exited."
Second, I am also seeing a ton of "Incorrect value type" errors. Most of them are either "Incorrect value type for key PictureRotate. Converting.", "Incorrect value type for key AudioDitherMethod. Converting.", or "Incorrect value type for key x264Option. Converting." How do I fix these?
Between these two errors, I am unable to get any farther with the process, and any help would be very much appreciated. Thanks!
HandBrake version (e.g., 1.0.0):
HandBrake 1.3.3 (2020061300) - MinGW x86_64
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Windows 10 Pro (OS Build 19041.630)
HandBrake Activity Log ***required***
Since HandBrake isn't even getting started, there was no activity log to post.