-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathFFmpeg.cs
46 lines (39 loc) · 1.31 KB
/
FFmpeg.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WebMConverter
{
class FFmpeg //Wrapper class to run the FFmpeg process
{
public string FFmpegPath = Path.Combine(Environment.CurrentDirectory, "ffmpeg/ffmpeg.exe");
public Process Process;
public FFmpeg(string argument)
{
Process = new Process();
ProcessStartInfo info = new ProcessStartInfo(FFmpegPath);
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.UseShellExecute = false; //Required to redirect IO streams
info.CreateNoWindow = true; //Hide console
info.Arguments = argument;
Process.StartInfo = info;
Process.EnableRaisingEvents = true; //!!!!
//Do the following calling start!
// Process.ErrorDataReceived += stuff;
// Process.OutputDataReceived += stuff;
// Process.Exited += stuff
//Start();
}
public void Start()
{
Process.Start();
Process.BeginErrorReadLine();
Process.BeginOutputReadLine();
}
}
}