PR #21465 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21465
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21465.patch

Previously x265 encoder used its default log level regardless of
FFmpeg's log level setting. Note the log level can be overwritten
by x265-params.

Fix #21462

Signed-off-by: Zhao Zhili <[email protected]>


>From 93225b4554d94ab39bd2e2c7598320eb1a1b1c91 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 14 Jan 2026 21:28:00 +0800
Subject: [PATCH] avcodec/libx265: map ffmpeg log level to x265 log level

Previously x265 encoder used its default log level regardless of
FFmpeg's log level setting. Note the log level can be overwritten
by x265-params.

Fix #21462

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavcodec/libx265.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 341868e7cd..b571e35101 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -250,6 +250,24 @@ static int handle_side_data(AVCodecContext *avctx, const 
x265_api *api,
     return 0;
 }
 
+static int get_x265_log_level(AVCodecContext *avctx)
+{
+    int level = av_log_get_level() + avctx->log_level_offset;;
+
+    if (level <= AV_LOG_QUIET)
+        return X265_LOG_NONE;
+    if (level <= AV_LOG_ERROR)
+        return X265_LOG_ERROR;
+    if (level <= AV_LOG_WARNING)
+        return X265_LOG_WARNING;
+    if (level <= AV_LOG_INFO)
+        return X265_LOG_INFO;
+    if (level <= AV_LOG_DEBUG)
+        return X265_LOG_DEBUG;
+
+    return X265_LOG_FULL;
+}
+
 static av_cold int libx265_encode_init(AVCodecContext *avctx)
 {
     libx265Context *ctx = avctx->priv_data;
@@ -285,6 +303,7 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
         return AVERROR(EINVAL);
     }
 
+    ctx->params->logLevel = get_x265_log_level(avctx);
     ctx->params->frameNumThreads = avctx->thread_count;
     if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
         ctx->params->fpsNum      = avctx->framerate.num;
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to