//项目引用 ffmpeg.exe 下载地址http://ffmpeg.org/
https://www.wowza.com/testplayers
var time = DateTime.Now; var minute = 2; //录制分钟 var fileName = Guid.NewGuid().ToString("N") + "_" + time.ToString("yyyyMMddHHmmss") + ".mp4"; string dir = Environment.CurrentDirectory; var proc = new Process(); proc.StartInfo.FileName = @"C:Windowssystem32cmd.exe"; proc.StartInfo.WorkingDirectory = dir; proc.StartInfo.UseShellExecute = true; proc.StartInfo.RedirectStandardInput = false; proc.StartInfo.RedirectStandardOutput = false; proc.StartInfo.RedirectStandardError = false; proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal; proc.StartInfo.CreateNoWindow = false; proc.StartInfo.Arguments = $"/k ffmpeg -i {RtmpUrl} -c:a copy -c:v copy -t {minute * 60} {fileName}"; //-t 单位秒 proc.Start();
proc.WaitForExit();
//proc.WaitForExit(1000 * minute * 60);//单位毫秒
//proc.Kill();
//proc.Close();
//转发的命令 插件ffmpeg.exe
proc.StartInfo.Arguments = $"/c ffmpeg -i {RtmpUrl} -rtsp_transport tcp -c:a copy -c:v libx264 -f flv rtmp://192.168.1.226:1935/live/abc";
ffmpeg -i rtmp://rtmp01open.ys7.com/openlive/1a0134e9981051e74935d0c1f.hd -c:a copy -c:v libx264 -f flv rtmp://192.168.2.101/live/abc
//录播的命令 插件ffmpeg.exe
ffmpeg -i rtmp://rtmp01open.ys7.com/openlive/1a01379bf52d41e74935d0c1f.hd -c:a copy -c:v libx264 -f flv rtmp://192.168.2.101/live/abc
//播放的命令 插件ffplay.exe
ffplay "rtmp://192.168.2.101:1935/live/abc live=1"
{RtmpUrl}