diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 70d66cd..2d1dbef 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -748,6 +748,61 @@ public class Program { config.FFmpegPath = config.FFmpegPath.Replace(@"\", @"\\"); } + + // Get FFmpeg version + try + { + var processStartInfo = new System.Diagnostics.ProcessStartInfo + { + FileName = config.FFmpegPath, + Arguments = "-version", + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true + }; + + using (var process = System.Diagnostics.Process.Start(processStartInfo)) + { + if (process != null) + { + string output = await process.StandardOutput.ReadToEndAsync(); + await process.WaitForExitAsync(); + + // Log full output + Log.Information("FFmpeg version output:\n{Output}", output); + + // Parse first line for console output + string firstLine = output.Split('\n')[0].Trim(); + if (firstLine.StartsWith("ffmpeg version")) + { + // Extract version string (text between "ffmpeg version " and " Copyright") + int versionStart = "ffmpeg version ".Length; + int copyrightIndex = firstLine.IndexOf(" Copyright"); + if (copyrightIndex > versionStart) + { + string version = firstLine.Substring(versionStart, copyrightIndex - versionStart); + AnsiConsole.Markup($"[green]ffmpeg version detected as {version}[/]\n"); + } + else + { + // Fallback if Copyright not found + string version = firstLine.Substring(versionStart); + AnsiConsole.Markup($"[green]ffmpeg version detected as {version}[/]\n"); + } + } + else + { + AnsiConsole.Markup($"[yellow]ffmpeg version could not be parsed[/]\n"); + } + } + } + } + catch (Exception ex) + { + Log.Warning(ex, "Failed to get FFmpeg version"); + AnsiConsole.Markup($"[yellow]Could not retrieve ffmpeg version[/]\n"); + } } else {