Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
-n
(global)
Do not overwrite output files, and exit immediately if
a specified output file already exists.
Usage:
$ ffmpeg -n -i input output.mp4
File 'output.mp4' already exists. Exiting.
-n
is a global option. Global options should be specified first.
The opposite option is -y
which will automatically overwrite the output without asking.
Note: There is a bug that causes -n
to not work in some cases, such as with the tee and image muxers. See bug report #8492: tee muxer silently overwrites output files. Until this bug is fixed it is recommended to test first or use your scripting language to check if the output exists.
–
Ideally your script should check for the existence of the input and output files prior to you calling ffmpeg to do its (potentially) dangerous operation. By dangerous I mean overwrite existing files...
Once you have ascertained whether the output already exists your script can move on to the next file for processing.
–