From 3ebed8c08756f3eef00f12f6488ee2d02cacaa56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Fri, 16 Oct 2026 22:42:00 +0200 Subject: [PATCH] avutil/log: match Windows warning yellow on a pipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows the console paints warnings with attribute 14 (bright yellow). The 8-color ANSI path used for a pipe emitted 0;33. Use intensity 1 for AV_LOG_WARNING on Windows so the piped color matches the console. Co-authored-by: Cursor Signed-off-by: Reinhard Nißl --- libavutil/log.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index 966522b013..6e52f970fd 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -189,11 +189,17 @@ static void check_color_terminal(void) static void ansi_fputs(int level, int tint, const char *str, int local_use_color) { if (local_use_color == 1) { + uint32_t intensity = (color[level] >> 4) & 15; + uint32_t fg = color[level] & 15; +#if defined(_WIN32) + /* Piped stderr is 8-color ANSI. Linux keeps 0;33m; Windows console + * already uses win_color 14 (bright yellow), so match that here. */ + if (level == AV_LOG_WARNING / 8) + intensity = 1; +#endif fprintf(stderr, "\033[%"PRIu32";3%"PRIu32"m%s\033[0m", - (color[level] >> 4) & 15, - color[level] & 15, - str); + intensity, fg, str); } else if (tint && use_color == 256) { fprintf(stderr, "\033[48;5;%"PRIu32"m\033[38;5;%dm%s\033[0m",