private static Instance PrepareInstance(string filePath, int outputCapacity, FFOptions ffOptions) { FFProbeHelper.RootExceptionCheck(); FFProbeHelper.VerifyFFProbeExists(ffOptions); var arguments = $"-loglevel error -print_format json -show_format -sexagesimal -show_streams \"{filePath}\""; var instance = new Instance(GlobalFFOptions.GetFFProbeBinaryPath(), arguments) { DataBufferCapacity = outputCapacity }; return(instance); }
private Instance PrepareInstance(FFOptions ffMpegOptions, out CancellationTokenSource cancellationTokenSource) { FFMpegHelper.RootExceptionCheck(); FFMpegHelper.VerifyFFMpegExists(ffMpegOptions); var startInfo = new ProcessStartInfo { FileName = GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), Arguments = _ffMpegArguments.Text, StandardOutputEncoding = ffMpegOptions.Encoding, StandardErrorEncoding = ffMpegOptions.Encoding, }; var instance = new Instance(startInfo); cancellationTokenSource = new CancellationTokenSource(); if (_onOutput != null || _onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null)) { instance.DataReceived += OutputData; } return(instance); }