From c2d28055c1e9f11334b9a079221ef6e43f43b63c Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Mon, 1 Nov 2021 18:13:23 +0100 Subject: [PATCH] Support for specyfying process working directory through FFOptions (#272) --- FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs | 11 ++++++----- FFMpegCore/FFOptions.cs | 5 +++++ FFMpegCore/FFProbe/FFProbe.cs | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs index 060ffc3..0fac769 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs @@ -145,17 +145,18 @@ private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList + /// Working directory for the ffmpeg/ffprobe instance + /// + public string WorkingDirectory { get; set; } = string.Empty; + /// /// Folder container ffmpeg and ffprobe binaries. Leave empty if ffmpeg and ffprobe are present in PATH /// diff --git a/FFMpegCore/FFProbe/FFProbe.cs b/FFMpegCore/FFProbe/FFProbe.cs index 89f905d..d0e8ea8 100644 --- a/FFMpegCore/FFProbe/FFProbe.cs +++ b/FFMpegCore/FFProbe/FFProbe.cs @@ -165,7 +165,8 @@ private static Instance PrepareInstance(string arguments, int outputCapacity, FF var startInfo = new ProcessStartInfo(GlobalFFOptions.GetFFProbeBinaryPath(), arguments) { StandardOutputEncoding = ffOptions.Encoding, - StandardErrorEncoding = ffOptions.Encoding + StandardErrorEncoding = ffOptions.Encoding, + WorkingDirectory = ffOptions.WorkingDirectory }; var instance = new Instance(startInfo) { DataBufferCapacity = outputCapacity }; return instance;