[FFmpeg-user] How to preserve file time

Bouke / Videotoolshed bouke at videotoolshed.com
Sat Aug 17 23:10:54 EEST 2024


>>> 
>>> Which is  exactly what I mean by "delete".
>> 
>> but there is no delete action
> You can spin it however you like. The logic around the ‘-y’ option requires an extra additional OS call, in this case querying the existence of the file, before it is overwritten.

This is not ’spinning’, people are telling you how it actually works.
If a file exists, and you open it and start writing at the start, it will be ‘another’ file with the same name.
This is what happens on a save action. Open a file for writing (and create it if it does not exist), set ‘cursor’ (file position) to start, and dump your load. (Pardon my French)

> Even more ... if the option is not set, a console output must be initiated and the user's input must be parsed too. With the option I suggested, this would not be necessary.

The user input is parsed as ‘if file exists and not -y in line, abort’ (I have not looked in the code, as I don’t speak C, but I’m pretty sure this is it.)

> 
>>> Some of you argue, that "OS / file system tasks" should not be in the scope of FFmpeg CLI.
>>> 
>>> To me, "deleting/overwriting existing files" and "preserving file times from input to output" are *both* "OS / file system tasks"
>> 
>> what a nonsense - each and every application overwrites files when you press "save"
> When you think of "press", then we are in the GUI world. Most GUI applications I know, ask explicitly before overwriting.

Of course not. Save (and for some apps autosave) NEVER asks to overwrite, you would get stark raving mad if it did.  ’Save As’ however does ask, as you might want to destroy some work.
Granted, you can do a select all, press space, press cmd S and pray for undo, but that’s another story.

Now drop the subject. If you can script FFmpeg, you have a perfect good solution with just two little lines of script.

Bouke



More information about the ffmpeg-user mailing list