[FFmpeg-devel] [PATCH 21/29] fftools/ffmpeg_mux_init: print more meaningful error messages
Anton Khirnov
anton at khirnov.net
Sun Apr 9 17:08:45 EEST 2023
---
fftools/ffmpeg_mux_init.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 3490c99c94..4b6c704046 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -2247,7 +2247,8 @@ int of_open(const OptionsContext *o, const char *filename)
err = avformat_alloc_output_context2(&oc, NULL, o->format, filename);
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);
}
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 */
- if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
- if (!av_filename_number_test(oc->url)) {
- print_error(oc->url, AVERROR(EINVAL));
- exit_program(1);
- }
+ if (oc->oformat->flags & AVFMT_NEEDNUMBER && !av_filename_number_test(oc->url)) {
+ av_log(mux, AV_LOG_FATAL,
+ "Output filename '%s' does not contain a numeric pattern like "
+ "'%%d', which is required by output format '%s'.\n",
+ oc->url, oc->oformat->name);
+ exit_program(1);
}
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,
&oc->interrupt_callback,
&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);
}
} else if (strcmp(oc->oformat->name, "image2")==0 && !av_filename_number_test(filename))
--
2.39.1
More information about the ffmpeg-devel
mailing list