添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

    I ran ffmpeg -n -i input.vid output/%06d.png and it clobbered the pre-existing output files. – Arnon Weinberg Oct 5, 2020 at 4:50

    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.

    if you're using python, you can check if the file exists using pathlib - stackoverflow.com/a/82852/1265980 – Ereli Jun 17, 2018 at 21:14