From ab82e3cc0fe90bc7bb439479e1e568c91b98b5a6 Mon Sep 17 00:00:00 2001 From: cephei Date: Thu, 8 Jul 2021 20:17:09 +0800 Subject: [PATCH] support specific StandardOutputEncoding & StandardErrorEncoding for ffprobe --- FFMpegCore/FFProbe/FFProbe.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FFMpegCore/FFProbe/FFProbe.cs b/FFMpegCore/FFProbe/FFProbe.cs index ab35457..6fa16a1 100644 --- a/FFMpegCore/FFProbe/FFProbe.cs +++ b/FFMpegCore/FFProbe/FFProbe.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.IO; using System.Text.Json; using System.Threading.Tasks; @@ -117,7 +118,13 @@ private static Instance PrepareInstance(string filePath, int outputCapacity, FFO FFProbeHelper.RootExceptionCheck(); FFProbeHelper.VerifyFFProbeExists(ffOptions); var arguments = $"-loglevel error -print_format json -show_format -sexagesimal -show_streams \"{filePath}\""; - var instance = new Instance(GlobalFFOptions.GetFFProbeBinaryPath(), arguments) {DataBufferCapacity = outputCapacity}; + var startInfo = new ProcessStartInfo(GlobalFFOptions.GetFFProbeBinaryPath(), arguments) + { + StandardOutputEncoding = ffOptions.Encoding, + StandardErrorEncoding = ffOptions.Encoding + }; + var instance = new Instance(startInfo) + { DataBufferCapacity = outputCapacity }; return instance; } }