Opened 12 years ago
#4290 new enhancement
Don't abort when existing output file is detected; instead skip to next output file
| Reported by: | Psychonaut | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug: By default, FFmpeg prompts the user when it detects an existing output file. If the user answers no, the program aborts. (The -n option has the same effect.) This is inconvenient when the command line contains several output files, some of which exist and some of which do not, and the user simply wants to create all non-existing output files. This is a very common use case when, for example, you are splitting a huge input file into several output files, the process gets interrupted partway through, and you want to resume it.
How to reproduce:
$ ls *.mkv
output1.mkv
$ ffmpeg -i input.avi -ss 2.80813 -to 224.985 -acodec flac -c:v libx264 -n output1.mkv -ss 741.965 -to 958.609 -acodec flac -c:v libx264 -n output2.mkv
ffmpeg version N-43893-ga73c411- http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 30 2015 01:32:44 with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --cc=gcc-4.9
libavutil 54. 18.100 / 54. 18.100
libavcodec 56. 21.101 / 56. 21.101
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 9.101 / 5. 9.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'input.avi':
Metadata:
encoder : Lavf56.4.101
Duration: 02:42:40.58, start: 0.000000, bitrate: 16035 kb/s
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0, 384x256, 14614 kb/s, 59.83 fps, 59.83 tbr, 59.83 tbn, 59.83 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
File 'output1.mkv' already exists. Exiting.
Above is a minimal example with just two output files. The problem is, of course, more serious when the command line contains dozens of output files.
Suggested fix: In interactive mode, when asking the user if a given output file is to be overwritten, there should be three choices: (y)es, (n)o, and (a)bort. (N)o should simply skip the current output file, and processing should continue with the next output file on the command line. (This should be the default option.) (A)bort should cause FFmpeg to immediately quit. The -n command-line option should have the same effect as the user typing (n)o to every prompt. If there is any use case for the old behaviour, then another command line option such as -abort could be added which has the same effect as the user typing (a)bort to every prompt.


