ffmpeg overwrite output file if exists

Ffmpeg

Ffmpeg Problem Overview


I ran:

ffmpeg -i input.flac output.mp3

This prompts:

> File 'output.mp3' already exists. Overwrite? [y/N] y

How do I automatically say "yes"?

Ffmpeg Solutions


Solution 1 - Ffmpeg

Use the -y option to automatically overwrite [docs]:

ffmpeg -y -i input.flac output.mp3

Solution 2 - Ffmpeg

I need to add the -y global switch before specifying the output file to accomplish this

ffmpeg -i /audio/191079007530_1_01.flac -t 51 -ss 69 -y /clips/44z274v23303t264y2z2s2s2746454t234_clip.mp3 2>&1 >> /ffmpegLogs.log

> Alternatively, you can use the -n option to deny overriding the > file.

Solution 3 - Ffmpeg

If there's someone using the ffmpeg-python wrapper, then you can use overwrite_output arg when running the stream.

stream = ffmpeg.input('dummy.mp4')
stream = ffmpeg.filter(stream, 'fps', fps=25, round='up')
stream = ffmpeg.output(stream, 'dummy2.mp4')
ffmpeg.run(stream, overwrite_output=True)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMuhammad Omer AslamView Question on Stackoverflow
Solution 1 - FfmpegVeerView Answer on Stackoverflow
Solution 2 - FfmpegMuhammad Omer AslamView Answer on Stackoverflow
Solution 3 - FfmpegleminhnguyenView Answer on Stackoverflow