From d62cc2423d28fe7c940f6dee2c8f6b1350a16156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3?= Date: Sat, 6 Jul 2024 23:36:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89ffmpeg=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Config.cs | 26 ++++++++++++++++++++++++-- Core/Tools/Transcode.cs | 6 +++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Core/Config.cs b/Core/Config.cs index 6320d645d..1f7265e80 100644 --- a/Core/Config.cs +++ b/Core/Config.cs @@ -892,7 +892,7 @@ public int _DefaultResolution_For_ComboBox { get { - switch(_DefaultResolution) + switch (_DefaultResolution) { case 80: return 0; @@ -909,7 +909,7 @@ public int _DefaultResolution_For_ComboBox case 30000: return 6; default: - return 4; + return 4; } } set @@ -1848,6 +1848,28 @@ public long _AutomaticFileCleaningThreshold } } + private static string UsingCustomFFMPEG = string.Empty; + /// + /// 是否使用自定义FFMPEG路径,如果要使用,该值为ffmpeg.exe的绝对路径,例如[D:/test/ffmpeg.exe] + /// 默认值:string.Empty + /// + public string _UsingCustomFFMPEG + { + get + { + return UsingCustomFFMPEG; + } + set + { + if (value.ToString() != UsingCustomFFMPEG) + { + UsingCustomFFMPEG = value.ToString(); + OnPropertyChanged(); + ModifyConfig(value); + } + } + } + } #endregion } diff --git a/Core/Tools/Transcode.cs b/Core/Tools/Transcode.cs index 23c603f92..1161bc869 100644 --- a/Core/Tools/Transcode.cs +++ b/Core/Tools/Transcode.cs @@ -66,7 +66,11 @@ public async Task TranscodeAsync(string before, string after, RoomCardClass Card }; // 捕捉的信息 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - if (File.Exists("./Plugins/ffmpeg/ffmpeg.exe")) + if (!string.IsNullOrEmpty(Config.Core_RunConfig._UsingCustomFFMPEG) && File.Exists(Config.Core_RunConfig._UsingCustomFFMPEG)) + { + process.StartInfo.FileName = Config.Core_RunConfig._UsingCustomFFMPEG; + } + else if (File.Exists("./Plugins/ffmpeg/ffmpeg.exe")) { process.StartInfo.FileName = "./Plugins/ffmpeg/ffmpeg.exe"; }