12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Diagnostics;
- using Vinno.IUS.Common.Log;
- namespace Vinno.IUS.Common.Media.FFmpeg
- {
- public static class FFmpegService
- {
- private static string _ffmpegPath = "ffmpeg";
- public static void SetFFmpegPath(string ffmpegPath)
- {
- _ffmpegPath = ffmpegPath;
- }
- public static void StartFFmpeg(out Process process,string arguments, FFmpegLog logItem = null)
- {
- process = new Process
- {
- StartInfo =
- {
- FileName = _ffmpegPath,
- Arguments = arguments,
- UseShellExecute = false,
- Verb = "runas",
- CreateNoWindow = true,
- RedirectStandardError = true,
- RedirectStandardInput = true
- },
- EnableRaisingEvents = true
- };
- if (logItem != null)
- {
- process.ErrorDataReceived += (s, e) => Logger.WriteLineWarn("ErrorDataReceived:" + e.Data);
- }
- process.Start();
- process.BeginErrorReadLine();
- }
- }
- }
|