PR #25712 opened by Kilian (lusoris)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25712
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25712.patch

`uninit()` ignores the return value of `vmaf_write_output()`, so a `log_path` 
that cannot be written leaves no error in the FFmpeg log. This checks the 
result and logs the path and the error.

libvmaf prints its own `could not open file` line to stderr, but that bypasses 
`av_log()`, so it ignores `-loglevel` and carries no filter context.

**Tests**

- `log_path=/nonexistent/dir/x.json`: base logs nothing through `av_log()`; now 
`problem writing libvmaf output to /nonexistent/dir/x.json: Invalid argument.` 
(libvmaf 3.2.0 returns -EINVAL when the file cannot be opened).
- Writable `log_path`: no new message, and the JSON log holds all 5 frames.
- No new build warnings; `tools/patcheck` reports only the changelog hint.

This came up in the automated review of PR 25613 and does not change that PR. 
The patch touches only the log-write lines in `uninit()`; PRs 24973, 24978, 
25613 and 25708 each still apply cleanly on top of it.



>From 939f59f28e9c292461846370f5af41b2c20f9605 Mon Sep 17 00:00:00 2001
From: lusoris <[email protected]>
Date: Tue, 3 Nov 2026 13:40:12 +0100
Subject: [PATCH] avfilter/vf_libvmaf: report a failed log write

uninit() ignored the return value of vmaf_write_output(), so a log
file that could not be written left no error in the FFmpeg log. libvmaf
only prints its own message to stderr, outside av_log() and its level
handling.

Check the result and log the path and the error.

Signed-off-by: lusoris <[email protected]>
---
 libavfilter/vf_libvmaf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 851b0982f02..21073c4285f 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -663,8 +663,14 @@ static av_cold void uninit(AVFilterContext *ctx)
     }
 
     if (s->vmaf) {
-        if (s->log_path && !err)
-            vmaf_write_output(s->vmaf, s->log_path, log_fmt_map(s->log_fmt));
+        if (s->log_path && !err) {
+            err = vmaf_write_output(s->vmaf, s->log_path, 
log_fmt_map(s->log_fmt));
+            if (err < 0) {
+                av_log(ctx, AV_LOG_ERROR,
+                       "problem writing libvmaf output to %s: %s.\n",
+                       s->log_path, av_err2str(err));
+            }
+        }
     }
 
 clean_up:
-- 
2.54.0

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

Reply via email to