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("");
}

}
}
}

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐