1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

fftools/ffmpeg_mux_init: print more meaningful error messages

This commit is contained in:
Anton Khirnov
2023-03-30 11:34:21 +02:00
parent 5297250920
commit 798da60e6a

View File

@@ -2247,7 +2247,8 @@ int of_open(const OptionsContext *o, const char *filename)
err = avformat_alloc_output_context2(&oc, NULL, o->format, filename); err = avformat_alloc_output_context2(&oc, NULL, o->format, filename);
if (!oc) { if (!oc) {
print_error(filename, err); av_log(mux, AV_LOG_FATAL, "Error initializing the muxer for %s: %s\n",
filename, av_err2str(err));
exit_program(1); exit_program(1);
} }
mux->fc = oc; mux->fc = oc;
@@ -2334,11 +2335,12 @@ int of_open(const OptionsContext *o, const char *filename)
} }
/* check filename in case of an image number is expected */ /* check filename in case of an image number is expected */
if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (oc->oformat->flags & AVFMT_NEEDNUMBER && !av_filename_number_test(oc->url)) {
if (!av_filename_number_test(oc->url)) { av_log(mux, AV_LOG_FATAL,
print_error(oc->url, AVERROR(EINVAL)); "Output filename '%s' does not contain a numeric pattern like "
exit_program(1); "'%%d', which is required by output format '%s'.\n",
} oc->url, oc->oformat->name);
exit_program(1);
} }
if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!(oc->oformat->flags & AVFMT_NOFILE)) {
@@ -2349,7 +2351,8 @@ int of_open(const OptionsContext *o, const char *filename)
if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE, if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE,
&oc->interrupt_callback, &oc->interrupt_callback,
&mux->opts)) < 0) { &mux->opts)) < 0) {
print_error(filename, err); av_log(mux, AV_LOG_FATAL, "Error opening output %s: %s\n",
filename, av_err2str(err));
exit_program(1); exit_program(1);
} }
} else if (strcmp(oc->oformat->name, "image2")==0 && !av_filename_number_test(filename)) } else if (strcmp(oc->oformat->name, "image2")==0 && !av_filename_number_test(filename))