ffmpeg overwrite output file if exists
Solution 1
Use the -y
option to automatically overwrite [docs]:
ffmpeg -y -i input.flac output.mp3
Solution 2
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
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)
Related videos on Youtube
![Muhammad Omer Aslam](https://i.stack.imgur.com/j9Csa.jpg?s=256&g=1)
Muhammad Omer Aslam
Managing Consultant, working since 2007 in the software development industry. Currently, working with Systems Ltd, after serving 10 years (2011~2021) in NextBridge Pvt Ltd. My working domain is mainly Php & Mysql, have worked in several frameworks and still learning. I like coding and inventing new ideas, playing Counter strike 1.6 and cricket, and sometimes I just like picking my nose. #Contribution to Stack Overflow Nov 2017 ~ Today# TOP 30 Contributors from Pakistan TOP 10 Contributors for Yii2 TOP Contributor For Yii2 from Pakistan TOP Contributor from Asia for Yii2
Updated on May 05, 2022Comments
-
Muhammad Omer Aslam about 2 years
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"?
-
llogan over 6 yearsAlternatively there is also the
-n
option to automatically never overwrite files. -
Veer over 6 yearsfor YES -y and for NO -n.
-
squarecandy almost 6 yearsIt's perfectly fine to answer your own question, even right away. It helped me find the answer I was looking for - that's what SO is all about. meta.stackexchange.com/questions/17845/…
-
TheKarateKid about 5 yearsLink to relevant documentation for those interested: ffmpeg.org/ffmpeg.html#toc-Main-options
-
cwongmath about 2 yearswas looking for this exact thing, thanks!