feature proposal - avoid overwriting the input file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

feature proposal - avoid overwriting the input file

Mikhail V
Currently it is possible to delete the input file if I specify same
filename in output,
for example:

ffmpeg -y -i input input

or simply:
ffmpeg -i input input
(this will promt y/n)

So this will immideately destroy the input file.
It did not happened with me often, but still happened a pair of times.
Was quite funny actually :) Funniest thing that I could not recover the file
because it is same name.

So, it would be nice if ffmpeg compare the output path with all input paths
and exit with an error.


Mikhail
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: feature proposal - avoid overwriting the input file

Lou-2
On Tue, Oct 10, 2017, at 03:40 PM, Mikhail V wrote:
> So, it would be nice if ffmpeg compare the output path with all input
> paths
> and exit with an error.

This is ticket #4655.
https://trac.ffmpeg.org/ticket/4655
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: feature proposal - avoid overwriting the input file

James Girotti
In reply to this post by Mikhail V
On Tue, Oct 10, 2017 at 4:40 PM, Mikhail V <[hidden email]> wrote:

> Currently it is possible to delete the input file if I specify same
> filename in output,
> for example:
>
> ffmpeg -y -i input input
>

Aren't you specifying that with '-y' you want to "overwrite output file
without asking"


> or simply:
> ffmpeg -i input input
> (this will promt y/n)
>

I believe this is the default behavior for any output file that is present
whether it matches input or not (in my example both foo.mkv and bar.mkv
file present):

ffmpeg -i foo.mkv bar.mkv
Input #0, matroska,webm, from 'foo.mkv':
  Metadata:
    ENCODER         : Lavf57.71.100
  Duration: 01:00:30.05, start: 0.000000, bitrate: 5195 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080 [SAR
1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      ENCODER         : Lavc57.89.100 h264_nvenc
      DURATION        : 01:00:30.047000000
    Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
    Metadata:
      ENCODER         : Lavc57.89.100 aac
      DURATION        : 01:00:30.021000000
File 'bar.mkv' already exists. Overwrite ? [y/N]


> So this will immideately destroy the input file.
> It did not happened with me often, but still happened a pair of times.
>

That is why almost never user '-y' and only if I am 100% certain it is
safe. Which in my case are FIFOs


> Was quite funny actually :) Funniest thing that I could not recover the
> file
> because it is same name.
>

That reminds me of when I accidentally did 'rm -rf /*'


>
> So, it would be nice if ffmpeg compare the output path with all input paths
> and exit with an error.
>

Is it possible for you to run your command without '-y' or if you're using
a script, then to compare your input and output before passing them to
ffmpeg?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: feature proposal - avoid overwriting the input file

Gyan
In reply to this post by Lou-2

On 10/11/2017 5:40 AM, Lou wrote:
> On Tue, Oct 10, 2017, at 03:40 PM, Mikhail V wrote:
>> So, it would be nice if ffmpeg compare the output path with all input
>> paths
>> and exit with an error.
>
> This is ticket #4655.
> https://trac.ffmpeg.org/ticket/4655

Occasionally, a user does this deliberately, when they're trying to just
add or alter some tags. Dedicated tag editors, in general, don't create
a new file. So, we've had a few users who inadvertently destroyed their
input. Implementing this will avoid those cases.

This is useful, independently of whether -y was applied. An exemption
can be made for streaming input/outputs.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".