Support specifying output encoding for ffmpeg and ffprobe output

Former-commit-id: a4aba666cd
This commit is contained in:
Malte Rosenbjerg 2020-12-09 17:07:41 +01:00
parent 949dc76f3f
commit be477197cc
2 changed files with 10 additions and 1 deletions

View file

@ -130,7 +130,14 @@ private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSo
{ {
FFMpegHelper.RootExceptionCheck(); FFMpegHelper.RootExceptionCheck();
FFMpegHelper.VerifyFFMpegExists(); FFMpegHelper.VerifyFFMpegExists();
var instance = new Instance(FFMpegOptions.Options.FFmpegBinary(), _ffMpegArguments.Text); var startInfo = new ProcessStartInfo
{
FileName = FFMpegOptions.Options.FFmpegBinary(),
Arguments = _ffMpegArguments.Text,
StandardOutputEncoding = FFMpegOptions.Options.Encoding,
StandardErrorEncoding = FFMpegOptions.Options.Encoding,
};
var instance = new Instance(startInfo);
cancellationTokenSource = new CancellationTokenSource(); cancellationTokenSource = new CancellationTokenSource();
if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null)) if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace FFMpegCore namespace FFMpegCore
@ -48,6 +49,7 @@ static FFMpegOptions()
public Dictionary<string, string> ExtensionOverrides { get; private set; } = new Dictionary<string, string>(); public Dictionary<string, string> ExtensionOverrides { get; private set; } = new Dictionary<string, string>();
public bool UseCache { get; set; } = true; public bool UseCache { get; set; } = true;
public Encoding Encoding { get; set; } = Encoding.Default;
private static string FFBinary(string name) private static string FFBinary(string name)
{ {