Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files Not Outputting When Overwrite Existing Files is Unchecked #1906

Open
5 tasks done
ChicagoScanningMG opened this issue Feb 27, 2024 · 13 comments
Open
5 tasks done

Comments

@ChicagoScanningMG
Copy link

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Operating System

Windows 10

Steps to reproduce

Bring in an MP4 files with h.264 encoding, trim the end by selecting a new out point, save the file with the generated name ${FILENAME}${EXT}, make sure Overwrite existing files is UNSELECTED. Everything else should be default. Then export file.

It seems the issue may come from using variables to name files. If it works the first time, try it a second time, but with a differently named file to confirm. If I add a suffix to the file name such as ${FILENAME}_TEST${EXT} the file will output, but if I have previously output a file using the variable format, I cannot succesffully output a second file, with a different name, using the same ${FILENAME}${EXT} format.

Expected behavior

The file should begin exporting just like any other file. If there is a file name collision, the file should still export but with a suffix added. Ideally a number. So if VideoFile.MP4 already exists, it should create VideoFile (1).MP4 - which is how Windows usually handles duplicate files. Or Mac which would created VideoFile copy.MP4 and subsequently VideoFile copy(1).MP4.

Additionally, if a file doesn't output at all, it would be nice if the confirmation message explicitly said so.

Actual behavior

Instead, when I export the file, I'm immediately given the completed dialog pop up and it shows possible errors, including "Overwrite files setting disabled, some files might have been skipped." I can verify that there are no file name collisions in the folder where I am trying to save the file. I am also opening a file locally and trying to save it to network drive.

Share log from developer tools

No response

@mifi
Copy link
Owner

mifi commented Feb 28, 2024

not exactly sure what you are doing to reproduce the issue and what's the problem. Basically when the checkbox is unchecked, losslesscut will not overwrite existing files with the same name. this was a feature request because some people want to not have to re-export already processed segments (speed improvement). Maybe you could try to explain using the actual file names that you are using?

@ChicagoScanningMG
Copy link
Author

File 1:

  1. Open 1234_Michael_001.MKV in Lossless Cut
  2. Trim File
  3. Set to rewrap as MP4
  4. Click Export
  5. Set output file name to ${FILENAME}${EXT}
  6. Set Save location to Network Drive
  7. Export
  8. Files saves as 1234_Michael_001.MP4 on my network Drive.

File 2:

  1. Open 5555_Smith_001.MKV in Lossless Cut
  2. Trim File
  3. Set to rewrap as MP4
  4. Click export
  5. Set output file name to ${FILENAME}${EXT}
  6. Deselct Overwrite Existing file
  7. Set save Location to network Drive
  8. Export
  9. File does not save to my network drive and Lossless Cut reports some files may have been skipped since Overwrite was deselected. Expected outcome was file to save as 5555_Smith_001.MP4 on my network drive. This file is not made, there is no file on my network drive called 5555_Smith_001.MP4

So I'm recording video files in OBS and I have a script set up that once I stop recording the video, a dialog pop-ups which allows me to name the saved file, then once the file is renamed, it will open the video file in LosslessCut. I have LosslessCut configured to output the file to a network drive with the same name as the file provided. So if the file name is "1234_Michael_001.MKV" I have LosslessCut set to rewrap the file as MP4 and set the output name using ${FILENAME}${EXT} to my network drive as "1234_Michael_001.MP4"

Now, the problem is, let's say I'm recording a new video, it's supposed to be "5555_Smith_001" but I put in the wrong name and instead use "1234_Michael_001". If I have overwrite selected, my new file will overwrite the original "1234_Michael_001", which is bad. If I have overwrite deselected, the file doesn't output nor am I warned that there is a file name collision. I still want to output the file. Usually when I'm outputting files, I'll hit export and then tab back to OBS to start a new recording, so I won't see any warning messages until I'm opening up a new video to edit. (I know, I'm sure this is a unique use case.)

File name collisions I can understand, but what isn't working is if I have previously saved "1234_Michael_001.MP4" and I have overwrite deselcted, and I export this file using ${FILENAME}${EXT} to autoname the output file. Then I open a brand new file, "5555_Smith_001.MKV" and output using ${FILENAME}${EXT} (so the output file name should be "5555_Smith_001.MP4") it will not save the file and reports that some files may have been skipped because overwrite wasn't selected. It seems to think that although the file has a unique name that it matches another file on my network drive, which it doesn't.

Based on other user requests, and why the feature was added, I think you need to add an option for handling file name collisions "Skip Already Processed Files" or "Save All Files With Unique Names." That way when people forget to properly rename a file, it will still export and then I'm not wondering later why my file didn't save properly. But the issue I'm having is that even when I'm saving with unique file names, it's not outputting files if overwrite is deselected.

I hope that cleared things up.

@mifi
Copy link
Owner

mifi commented Mar 2, 2024

Thanks for detailing. Hmm, I think this is a bug then. Just to be sure: your input directory is the same as the output directory right? If there exists no file named 5555_Smith_001.MP4, but it says that it will export this file name, then I don't understand why it doesn't. I assume there is no warning in the export confirm dialog before exporting, and I assume that you're on the latest version? I tried to reproduce the problem but I cannot. for me it does create the file, and I don't understand why it doesn't for you.

Also I don't undertstand what's the difference between File 1 and file 2. It seems you are doing the exact same thing, except that for File 1 you have the "Overwrite" option selected? (even though you didn't explicitly say). In that case if you run the File1 scenario again with Overwrite deselected, you get the same result as file2 right?

@ChicagoScanningMG
Copy link
Author

Very strange. Yeah, it's the latest version. My input directory is NOT the same as my output directory. Input directory is local on my machine, output directory is to a network drive.

File 1 is there to illustrate how I can get a successful export, and how I was doing things before the overwrite option was added. File 2, if done after exporting file 1, the file does not save and I am given those warning. It's there to illustrate that it's possible the bug has something to do with exporting a file using ${FILENAME}${EXT} back to back. It makes me wonder if your code that checks for file name collisions is somehow seeing that the previous file was exported using ${FILENAME}${EXT} and the next exported file is also using ${FILENAME}${EXT} rather than actually comparing the file names.

Just a thought. Either way, I'd still love to see more options (as listed in my previous comment) to handle file name collisions.

@mifi
Copy link
Owner

mifi commented Mar 5, 2024

Hmm, I'm still not sure I understand exactly. Did you have the overwrite option enabled or disabled while exporting File 1? before the overwrite option was added, all files would get overwritten (there were no checks in the code for existing files before trying to output).

@ChicagoScanningMG
Copy link
Author

That's correct. File 1 has overwrite enabled.

I'm just saying if you want to try and reproduce my results, I exported a file with overwrite enabled, saving to a network drive, use automatic file naming by using variables ${FILENAME}${EXT}, and this export is successful. If then export another file with a unique name, disable overwriting, save to a network drive, use automatic file naming with the variables ${FILENAME}${EXT}, the file does not export even though there is not already a file in the destination folder that matches the input file.

This leads me to believe the code sees the selected variables as the previous and current file name, rather than the actual file name itself. I can successfully export with overwriting disabled if I don't use file name variables. It has something to do with the file name variables.

But either way, there should be an option to export all files with unique names OR skip existing files. That way, rather than not exporting any possible file name collisions, it will still export the file with an added suffix of "_01" or "Copy."

@mifi
Copy link
Owner

mifi commented Mar 6, 2024

so if you don't export File 1 first, then File 2 exports successfully? or are you saying that as long as you have the output file name set to ${FILENAME}${EXT} (and overwrite disabled), no files will be outputted, regardless of their name, even if it's the first file you export after opening losslesscut?

@ChicagoScanningMG
Copy link
Author

It's the latter. I have not yet tested it with a fresh install nor on another machine. Even if I close LosslessCut and reopen, if the output file name is set to ${FILENAME}${EXT} (and overwrite disabled) no files will be output regardless of their name.

@mifi
Copy link
Owner

mifi commented Mar 14, 2024

ok, so to summarize, the bug that I need to try to reproduce is:

  1. set overwrite setting OFF
  2. open a file from a directory, e.g. /Users/me/Downloads/input.mp4
  3. filename template set to ${FILENAME}${EXT}
  4. choose a different working directory, e.g. /mount/somewhere
  5. confirm that there exists no file with the same name in working dir, e.g. /mount/somewhere/input.mp4 does not exist
  6. export and observe that nothing gets written to /mount/somewhere/input.mp4

@ChicagoScanningMG
Copy link
Author

ChicagoScanningMG commented Mar 14, 2024 via email

@mifi
Copy link
Owner

mifi commented Mar 14, 2024

I tried it now:

  • open losslesscut
  • only a single cut segment spanning the whole duration of the video
  • working dir set to /users/me/desktop
  • filename template ${FILENAME}${EXT}
  • export mode "separate files"
  • output container format unchanged
  • sanitize file names ON
  • set overwrite OFF
  • open /users/me/downloads/file1.mp4, export, successfully outputs /users/me/desktop/file1.mp4
  • open /users/me/downloads/file2.mp4, export, successfully outputs /users/me/desktop/file2.mp4

maybe this bug is windows-specific (im on macos)

@ChicagoScanningMG
Copy link
Author

ChicagoScanningMG commented Mar 14, 2024 via email

@mifi
Copy link
Owner

mifi commented Mar 19, 2024

I cannot find anything in the code that would cause this specifically for windows. do you see any warning in the export confirm dialog before exporting? also network drive doesn't have anything to do with the issue, right (e.g. it also does not output any files in a different directory on the same drive)? is the "sanitize file names" option enabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants