From 0da4849bae18d6a4e9d2497e9872042f02259e1a Mon Sep 17 00:00:00 2001 From: hal-tech-lab <94123916+hal-tech-lab@users.noreply.github.com> Date: Fri, 3 Jun 2022 13:56:34 +0900 Subject: [PATCH] FFmpeg.cs Fixed a bug that prevented ffmpeg from exiting with subtitled mkv files --- Code/FFmpeg/FFmpeg.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Code/FFmpeg/FFmpeg.cs b/Code/FFmpeg/FFmpeg.cs index 28a33a2..fb21155 100644 --- a/Code/FFmpeg/FFmpeg.cs +++ b/Code/FFmpeg/FFmpeg.cs @@ -73,7 +73,11 @@ public static string RunAndGetOutput (string args) Process ffmpeg = OsUtils.NewProcess(true); ffmpeg.StartInfo.Arguments = $"/C cd /D {Paths.binPath.Wrap()} & ffmpeg.exe -hide_banner -y -stats {args}"; ffmpeg.Start(); - ffmpeg.WaitForExit(); + if (!ffmpeg.WaitForExit(1000)) + { + ffmpeg.Kill(); + Process.Start("taskkill", "/F /IM ffmpeg.exe"); + } string output = ffmpeg.StandardOutput.ReadToEnd(); string err = ffmpeg.StandardError.ReadToEnd();