[FFmpeg-devel] [PATCH] fftools/ffprobe: Disable stderr buffering on Windows

softworkz ffmpegagent at gmail.com
Sun Apr 20 01:32:26 EEST 2025


From: softworkz <softworkz at hotmail.com>

An identical call exists in ffmpeg.c

With POSIX/glibc, stderr is already unbuffered (or line-buffered when
a terminal is connected), but not in case of MSVCRT.
Explicitly calling setvbuf() like in this commit, makes the Windows
runtime behave like POSIX, giving the same “print immediately” behavior.

Signed-off-by: softworkz <softworkz at hotmail.com>
---
    fftools/ffprobe: Disable stderr buffering on Windows
    
    An identical call exists in ffmpeg.c
    
    With POSIX/glibc, stderr is already unbuffered (or line-buffered when a
    terminal is connected), but not in case of MSVCRT. Explicitly calling
    setvbuf() like in this commit, makes the Windows runtime behave like
    POSIX, giving the same “print immediately” behavior.
    
    Signed-off-by: softworkz softworkz at hotmail.com

Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-67%2Fsoftworkz%2Fsubmit_probe_nobuf-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-67/softworkz/submit_probe_nobuf-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/67

 fftools/ffprobe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f5c83925b9..d980d4e64f 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3081,6 +3081,8 @@ int main(int argc, char **argv)
 
     init_dynload();
 
+    setvbuf(stderr, NULL, _IONBF, 0); /* win32 runtime needs this */
+
     av_log_set_flags(AV_LOG_SKIP_REPEATED);
 
     options = real_options;

base-commit: 7cd1edeaa410d977a9f1ff8436f480cb45b80178
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list