[FFmpeg-devel] Issue an error when forced format cannot be honnored
Etienne Buira
etienne.buira.lists
Sun Oct 25 00:11:05 CEST 2009
Hi.
The trouble with current version is if I specify:
ffmpeg -i input.avi -acodec copy -vcodec copy -f mpegtsraw output.mpeg
mpegtsraw being a valid demuxer, no error is issued, and the output file
ends up being mpeg without notice.
The attached patch makes ffmpeg issue an error if -f option cannot be
met.
Regards.
-------------- next part --------------
Index: ffmpeg.c
===================================================================
--- ffmpeg.c (revision 20357)
+++ ffmpeg.c (working copy)
@@ -111,6 +111,7 @@
static AVInputFormat *file_iformat;
static AVOutputFormat *file_oformat;
+static int forced_format = 0;
static int frame_width = 0;
static int frame_height = 0;
static float frame_aspect_ratio = 0;
@@ -2386,6 +2387,7 @@
file_iformat = av_find_input_format(arg);
file_oformat = guess_format(arg, NULL, NULL);
+ forced_format = 1;
if (!file_iformat && !file_oformat) {
fprintf(stderr, "Unknown input or output format: %s\n", arg);
av_exit(1);
@@ -2987,6 +2989,7 @@
nb_input_files++;
file_iformat = NULL;
file_oformat = NULL;
+ forced_format = 0;
video_channel = 0;
@@ -3348,6 +3351,10 @@
}
if (!file_oformat) {
+ if (forced_format) {
+ fprintf(stderr, "Invalid forced output format\n");
+ av_exit(1);
+ }
file_oformat = guess_format(NULL, filename, NULL);
if (!file_oformat) {
fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
@@ -3474,6 +3481,7 @@
/* reset some options */
file_oformat = NULL;
file_iformat = NULL;
+ forced_format = 0;
}
/* same option as mencoder */
More information about the ffmpeg-devel
mailing list