diff --git a/FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs b/FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs index c672c74..47564f9 100644 --- a/FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs @@ -16,8 +16,17 @@ public class DemuxConcatArgument : IInputArgument public readonly IEnumerable Values; public DemuxConcatArgument(IEnumerable values) { - Values = values.Select(value => $"file '{value}'"); + Values = values.Select(value => $"file '{Escape(value)}'"); } + + /// + /// Thanks slhck + /// https://superuser.com/a/787651/1089628 + /// + /// + /// + private string Escape(string value) => value.Replace("'", @"'\''"); + private readonly string _tempFileName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, $"concat_{Guid.NewGuid()}.txt"); public void Pre() => File.WriteAllLines(_tempFileName, Values);