HaveAGitGat / HBBatchBeast

A free GUI application for HandBrake and FFmpeg/FFprobe with an emphasis on batch conversion (including recursive folder scans and folder watching) -Windows, macOS, Linux & Docker
GNU General Public License v3.0
614 stars 55 forks source link

Dollar sign ($) in filename fails health check #21

Closed deepfriedmind closed 5 years ago

deepfriedmind commented 5 years ago
17-02-2019-13-06-37---Health---check--ERROR----------/Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative $100,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv
[13:06:37] hb_init: starting libhb thread
[13:06:37] thread 70000df33000 started ("libhb")
HandBrake 1.2.0 (2018122300) - Darwin x86_64 - https://handbrake.fr
8 CPUs detected
Opening /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv...
[13:06:37] CPU: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
[13:06:37]  - Intel microarchitecture Kaby Lake
[13:06:37]  - logical processor count: 8
[13:06:37] hb_scan: path=/Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv, title_index=1
disc.c:323: failed opening UDF image /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[13:06:37] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't stat /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv
No such file or directory
libdvdread: Could not open /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv
libdvdnav: vm: failed to open/read the DVD
[13:06:37] dvd: not a dvd - trying as a stream/file instead
[13:06:37] hb_stream_open: open /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv failed
[13:06:37] scan: unrecognized file type
[13:06:37] libhb: scan thread found 0 valid title(s)
No title found.
HandBrake has exited.
HaveAGitGat commented 5 years ago

Hi it appears this is an error which the HandbrakeCLI has produced. It seems the first issue is at:

disc.c:323: failed opening UDF image /Volumes/disk1/TV/Shows/Newsreaders/Season 02/Newsreaders - S02E02 - Motorboating Dads; the Negative 00,000 Question 720p HDTV DD 5.1 x264 - BAJSKORV.mkv

It may be worth checking on the Handbrake forum or subreddit to find out what causes this as I'm not familiar with all Handbrake's error codes.

deepfriedmind commented 5 years ago

It's because of the $1 in the filename, which gets treated like a variable in the shell. How are you escaping filenames passed to HandbrakeCLI?

HaveAGitGat commented 5 years ago

Ah very interesting thanks for letting me know. I only did a test on Windows with that file name so didn't run into any problems.

Here is the Linux/macOS command which is executed in shell. I'll have another look to see what can be done to escape special characters.

workerCommand ="HandBrakeCLI -i \"" + currentSourceLine + "\" -o \"" + currentDestinationLine + "\" " + preset;

HaveAGitGat commented 5 years ago

It's because of the $1 in the filename, which gets treated like a variable in the shell. How are you escaping filenames passed to HandbrakeCLI?

Fixed in v2.0.8 just released.

sjclayton commented 5 years ago

@HaveAGitGat -- Still having issues with this on Linux with any special characters (mainly single quotes that I've noticed) or different space delimiting in filenames (using v2.0.8). HBBatchBeast is therefore reporting such files as being corrupted.

Running HandbrakeCLI on these files manually and doing a scan shows they are not in fact corrupted at all, it's just a case of HandbrakeCLI getting jammed up on the input filename and then just erroring out.

I think it may have to do with this....

workerCommand ="HandBrakeCLI -i \"" + currentSourceLine + "\" -o \"" + currentDestinationLine + "\" " + preset;

I'm pretty sure you need single quotes around the outer part of the command... like so...

workerCommand ='HandBrakeCLI -i \"" + currentSourceLine + "\" -o \"" + currentDestinationLine + "\" ' + preset;

because what I believe is happening is.. the way it is now, when HandbrakeCLI executes the command, it is seeing the single quotes in the filenames as part of the command itself, and therefore it breaks the execution of the command and errors out.

HaveAGitGat commented 5 years ago

Hi, so it was originally this:

workerCommand ="HandBrakeCLI -i \"" + currentSourceLine + "\" -o \"" + currentDestinationLine + "\" " + preset;

Then I did some testing and changed it to this (solved issue with '$' in filename):

workerCommand ="HandBrakeCLI -i '" + currentSourceLine + "' -o '" + currentDestinationLine + "' " + preset;

I'll do some testing with your suggestion and report back. Thanks

HaveAGitGat commented 5 years ago

@sjclayton Had a play around with your suggestion as well as a few other ways but still no luck. I'm not sure it's possible for shell to execute commands which contain file paths with single quotes in. The single quotes always break up the shell command, causing errors. Will keep looking though.

HaveAGitGat commented 5 years ago

v2.1.3 has the option to automatically remove apostrophes/single quotes from filenames: image

HaveAGitGat commented 5 years ago

Fixed in 2.1.5 for Linux and macOS