--- ffmpeg-8.0.1/fftools/cmdutils.c.orig	2025-12-04 12:02:39.048902000 +0100
+++ ffmpeg-8.0.1/fftools/cmdutils.c	2025-12-04 12:03:09.025919500 +0100
@@ -72,6 +72,21 @@
     vfprintf(stdout, fmt, vl);
 }
 
+#if defined(_WIN32)
+static void
+exit_flush(void)
+{
+    fflush(NULL);
+}
+#endif
+
+void init_atexit(void)
+{
+#if defined(_WIN32)
+    atexit(exit_flush);
+#endif
+}
+
 void init_dynload(void)
 {
 #if HAVE_SETDLLDIRECTORY && defined(_WIN32)
--- ffmpeg-8.0.1/fftools/cmdutils.h.oriig	2025-12-04 12:03:14.817855900 +0100
+++ ffmpeg-8.0.1/fftools/cmdutils.h	2025-12-04 12:01:19.917757800 +0100
@@ -54,6 +54,8 @@
  */
 void init_dynload(void);
 
+void init_atexit(void);
+
 /**
  * Uninitialize the cmdutils option system, in particular
  * free the *_opts contexts and their contents.
--- ffmpeg-8.0.1/fftools/ffmpeg.c.orig	2025-12-04 11:58:38.637191900 +0100
+++ ffmpeg-8.0.1/fftools/ffmpeg.c	2025-12-04 12:05:01.143673400 +0100
@@ -968,6 +968,7 @@
     int ret;
     BenchmarkTimeStamps ti;
 
+    init_atexit();
     init_dynload();
 
     setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
--- ffmpeg-8.0.1/fftools/ffplay.c.orig	2025-11-20 03:31:18.000000000 +0100
+++ ffmpeg-8.0.1/fftools/ffplay.c	2025-12-04 12:04:57.040537600 +0100
@@ -3759,6 +3759,7 @@
     int flags, ret;
     VideoState *is;
 
+    init_atexit();
     init_dynload();
 
     av_log_set_flags(AV_LOG_SKIP_REPEATED);
--- ffmpeg-8.0.1/fftools/ffprobe.c.orig	2025-11-20 03:31:18.000000000 +0100
+++ ffmpeg-8.0.1/fftools/ffprobe.c	2025-12-04 12:04:51.566511900 +0100
@@ -3067,6 +3067,7 @@
     char *f_name = NULL, *f_args = NULL;
     int ret, input_ret, i;
 
+    init_atexit();
     init_dynload();
 
     setvbuf(stderr, NULL, _IONBF, 0); /* win32 runtime needs this */
