DVR-Scan icon indicating copy to clipboard operation
DVR-Scan copied to clipboard

Issue with `[` and `]` characters in filenames

Open thegreatgunbantoad opened this issue 1 year ago • 6 comments

Bug/Issue Description: Tool does not like the filenames my Camera produces, though to be fair they are a certain kind of evil: 00.08.00-00.16.00[R][0@0][0].mp4 Renaming the file something less atrocious does resolve the issue but I have 188 files, so going to have a script a rename.

Required Information:

Provide a full copy of the command line options you are using, and add --verbosity debug, for example: dvr-scan -i ".\00.00.00-00.08.00[R][0@0][0].mp4" -r --verbosity debug INFO: controller.parse_settings(): DVR-Scan 1.6.1 DEBUG: controller.parse_settings(): User config file not found. ERROR: controller._preprocess_args(): Error: Input file does not exist: .\00.00.00-00.08.00[R][0@0][0].mp4

Expected Behavior: It to open region editor

Computing Environment: Windows 11 canary channel build 26252 Python 3.12.4 OpenCV 4.10.0

Additional Information: none

thegreatgunbantoad avatar Jul 21 '24 22:07 thegreatgunbantoad

The issue arises from the [ and ] characters, which need to be "escaped" by surrounding them with square brackets like [this]. Could you try running the following instead?

dvr-scan -i ".\00.00.00-00.08.00[[]R[]][[]0@0[]][[]0[]].mp4" -r --verbosity debug

This replaces each [ with [[], and each ] with []]. Sorry this isn't documented anywhere, I'll add a task to add this information.

For Windows this is working as intended, as all input paths are globbed to allow wildcard expansion. I can also look at adding a config option to disable glob expansion, if you think that it would be helpful.

Thanks for the report, this is good to know.


Tasks:

  • [ ] Document globbing behavior
  • [ ] Investigate if we should avoid performing glob on Linux
  • [ ] Investigate adding config option to disable globbing and what defaults should be for each platform

Breakthrough avatar Jul 22 '24 01:07 Breakthrough

Firstly thank you for the response and that it was so swift. Cracking tool btw!

Sorry, I missed your response to this.

Yes: dvr-scan -i ".\00.00.00-00.08.00[[]R[]][[]0@0[]][[]0[]].mp4" -r --verbosity debug works great

I assumed (wrongly) that since that earlier command had failed a wild card of: dvr-scan -i *.mp4 -r --verbosity debug also would, but you're right it does work fine so I needent have done a renaming script.

Again, can't gush enough, great tool.

thegreatgunbantoad avatar Jul 23 '24 23:07 thegreatgunbantoad

Thanks for the feedback, glad you're finding the tool useful :)

If you're processing several videos at once, be sure to read through this section on handling multiple videos in the docs. It has some additional info on how concatenation happens, and explains what order files are processed in.

Breakthrough avatar Jul 24 '24 01:07 Breakthrough

I can confirm the [ and ] characters cause dvr-scan issues in Linux as well, not just Windows. While escaping [ and ] characters by doubling them is a workaround solution that I'm glad to know about now, it's a manual one that's a pain when dealing with hundreds of files. My own workaround was using Windows or Linux commands to copy or rename the problematic filename to something simple like "test.mp4", run dvr-scan on that file, and then copy or rename back, since the copy/rename commands on Windows and Linux don't have trouble with those characters. Now that I found this bug report I can envision scripting code to replace single [ and ] with doubled ones (trivial in Linux with awk, possibly trickier in Windows), but again that requires extra scripting and eliminates the ability to use wildcards in dvr-scan itself.

If resolving this issue globally isn't feasible, I would encourage you add that "disable globbing" config option you mentioned earlier. It looks like it didn't make it into 1.7.

n0lqu avatar Mar 07 '25 02:03 n0lqu

@n0lqu thanks for bringing that up, that's a fair point. I'll make sure this gets prioritized for the next release.

Breakthrough avatar Mar 07 '25 04:03 Breakthrough

ahh it's being a git again:

D:\Grab>dvr-scan -i *.mp4 -r --verbosity debug INFO: controller.parse_settings(): DVR-Scan 1.6.1 DEBUG: controller.parse_settings(): User config file not found. ERROR: controller._preprocess_args(): Error: Input file does not exist:

plently of stuff in there

Image

Also in parts keeps referring to a very old file. Can't break it that way right now though.

I'm sure thy is is user mupettry

thegreatgunbantoad avatar Apr 20 '25 21:04 thegreatgunbantoad