using System;
using System.Diagnostics;
namespace sendffmpeg
{
class Program
{
static void Main(string[] args)
{
int returnValue;
try
{
args = Environment.GetCommandLineArgs();
String ip = args[1];
String streamName = args[2];
//Console.ReadKey();
//string strExePath = "E:/工具/ffmpeg/ffmpeg.exe";
string strExePath = "ffmpeg.exe";
//string param = "-re -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -f flv -pix_fmt yuv420p rtmp://192.168.1.100:1935/live/desktop";
string param = "-re -f gdigrab -i desktop -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -f flv -pix_fmt yuv420p rtmp://" + ip + ":1935/live/" + streamName;
//ProcessStartInfo info = new ProcessStartInfo(strExePath);
ProcessStartInfo info = new ProcessStartInfo(strExePath,param);
info.UseShellExecute = false;
info.WindowStyle = ProcessWindowStyle.Hidden; //隐藏exe窗口状态
//info.CreateNoWindow = true; //隐藏本exe的窗口
Process proBach = Process.Start(info); //运行exe
// 取得EXE运行后的返回值,返回值只能是整型
//returnValue = proBach.ExitCode;
//Console.WriteLine("returnValue:" + returnValue);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.WriteLine("");
}
}
}
}