[FFmpeg-devel] [PATCH 19/49] fftools/ffmpeg: do not log to the muxer context

Anton Khirnov anton at khirnov.net
Mon Apr 4 14:30:07 EEST 2022


All other logging goes to NULL context.
---
 fftools/ffmpeg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index b9ecbf4739..a9a62eb8c3 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2960,7 +2960,6 @@ static void init_encoder_time_base(OutputStream *ost, AVRational default_time_ba
 {
     InputStream *ist = get_input_stream(ost);
     AVCodecContext *enc_ctx = ost->enc_ctx;
-    AVFormatContext *oc;
 
     if (ost->enc_timebase.num > 0) {
         enc_ctx->time_base = ost->enc_timebase;
@@ -2973,8 +2972,9 @@ static void init_encoder_time_base(OutputStream *ost, AVRational default_time_ba
             return;
         }
 
-        oc = output_files[ost->file_index]->ctx;
-        av_log(oc, AV_LOG_WARNING, "Input stream data not available, using default time base\n");
+        av_log(NULL, AV_LOG_WARNING,
+               "Input stream data for output stream #%d:%d not available, "
+               "using default time base\n", ost->file_index, ost->index);
     }
 
     enc_ctx->time_base = default_time_base;
@@ -2986,7 +2986,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
     AVCodecContext *enc_ctx = ost->enc_ctx;
     AVCodecContext *dec_ctx = NULL;
     OutputFile      *of = output_files[ost->file_index];
-    AVFormatContext *oc = of->ctx;
     int ret;
 
     set_encoder_id(output_files[ost->file_index], ost);
@@ -3049,8 +3048,9 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
         if (   av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH
            && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR ||
                (video_sync_method == VSYNC_AUTO && !(of->format->flags & AVFMT_VARIABLE_FPS)))){
-            av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n"
-                                       "Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
+            av_log(NULL, AV_LOG_WARNING, "Frame rate in output stream #%d:%d very high for a muxer not efficiently supporting it.\n"
+                   "Please consider specifying a lower framerate, a different muxer or -vsync 2\n",
+                   ost->file_index, ost->index);
         }
 
         enc_ctx->width  = av_buffersink_get_w(ost->filter->filter);
-- 
2.34.1



More information about the ffmpeg-devel mailing list