public async Task <IExtractionResult> Start(string parameters, CancellationToken cancellationToken) { if (_wrapper != null) { throw new InvalidOperationException("Must create another Extraction resource, cannot reuse."); } _wrapper = new FFmpegWrapper(); var result = new ExtractResult { StartTime = DateTimeOffset.UtcNow, Arguments = parameters, Tracks = _tracks, Success = true }; var processResult = await _wrapper.RunProcess(parameters, cancellationToken).ConfigureAwait(false); if (processResult.ExitCode != 0 || processResult.Output.ToLower().Contains("error")) { result.Success = false; result.Error = processResult.Output; } result.EndTime = DateTimeOffset.UtcNow; return(result); }