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

Support specifying output encoding for ffmpeg and ffprobe output
This commit is contained in:
Malte Rosenbjerg 2020-12-14 18:16:24 +01:00 committed by GitHub
commit 8fe7377bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -130,7 +130,14 @@ private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSo
{
FFMpegHelper.RootExceptionCheck();
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();
if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))

View file

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