Merge pull request #143 from rosenbjerg/feature/support-for-specifying-output-encoding

Support specifying output encoding for ffmpeg and ffprobe output

Former-commit-id: 8fe7377bbd
This commit is contained in:
Malte Rosenbjerg 2020-12-14 18:16:24 +01:00 committed by GitHub
commit 74c7dfddd6
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)
{ {