Ffmpeg-python: automatically stop overwrite

Created on 14 Aug 2019  路  2Comments  路  Source: kkroening/ffmpeg-python

I know that you can automatically overwrite if output exist with .overwrite_output()
but what if you don't want to overwrite?

it is not possible to add overwrite_output=True for over write and overwrite_output=False for not.

Most helpful comment

@153957

Note that 'False' is already the default. If you simply do not specify it it will not overwrite it.

I was not able to confirm this behavior. overwrite_output=False acts as if neither -y nor -n was specified, making it ask interactively and then error out when file exists, whereas one would expect overwrite_output=False to just _not overwrite_ the file.

Current behavior:

  • overwrite_output=False -> asks interactively, errors out when not overwriting
  • overwrite_output=True -> overwrites (-y)
  • overwrite_output not specified -> same as overwrite_output=False

Expected (intuitive) behavior:

  • overwrite_output=False -> does not overwrite (-n)
  • overwrite_output=True -> overwrites (-y)
  • overwrite_output not specified (perhaps the default should be overwrite_output=None) -> errors out when file exists

All 2 comments

If you call ffmpeg-python like this:

import ffmpeg
stream = ffmpeg.input('input.mp4')
stream = ffmpeg.output(stream, 'output.mp4')
ffmpeg.run(stream, overwrite_output=False)

You can provide the overwrite_output keyword when calling run or other 'output' methods.
Here is the option in the source code for the run method: https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/_run.py#L297
Note that 'False' is already the default. If you simply do not specify it it will not overwrite it.
The other output_operators also have that keyword.

@153957

Note that 'False' is already the default. If you simply do not specify it it will not overwrite it.

I was not able to confirm this behavior. overwrite_output=False acts as if neither -y nor -n was specified, making it ask interactively and then error out when file exists, whereas one would expect overwrite_output=False to just _not overwrite_ the file.

Current behavior:

  • overwrite_output=False -> asks interactively, errors out when not overwriting
  • overwrite_output=True -> overwrites (-y)
  • overwrite_output not specified -> same as overwrite_output=False

Expected (intuitive) behavior:

  • overwrite_output=False -> does not overwrite (-n)
  • overwrite_output=True -> overwrites (-y)
  • overwrite_output not specified (perhaps the default should be overwrite_output=None) -> errors out when file exists
Was this page helpful?
0 / 5 - 0 ratings

Related issues

laurentalacoque picture laurentalacoque  路  4Comments

Woolwit picture Woolwit  路  4Comments

ghost picture ghost  路  3Comments

CNugteren picture CNugteren  路  5Comments

oveddan picture oveddan  路  3Comments