当前位置:网站首页>C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
2020-11-09 17:46:00 【TSINGSEE】
之前写过一篇科普文《如何使用RTSP推流组件EasyPusher将MP4文件推到EasyDarwin开源平台》,在该文中 ,我们尝试了通过EasyPusher将MP4文件推到EasyDarwin,但是除了这个方法之外,我们还有其他方法将MP4文件推送到EasyDarwin上。
本文就和大家分享一下C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程。
1、新建一个控制台应用项目,将下载好的FFMPEG放在程序根目录下面,如下图:
在main函数中写如下代码:
static void Main(string[] args)
{
string exePath = "./ffmpeg/bin/ffmpeg.exe";
string arguments = "";
arguments = "-re -stream_loop -1 -i test.mp4 -vf ";
arguments += "settb=AVTB,setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',drawtext=fontsize=20:fontcolor=white:text='%{localtime}'";
arguments += " -rtsp_transport tcp -vcodec h264 -f rtsp rtsp://127.0.0.1:554/test2.sdp";
ProcessStartInfo info = new ProcessStartInfo(exePath, arguments);
info.WindowStyle = ProcessWindowStyle.Hidden;
info.UseShellExecute = false;
info.RedirectStandardInput = false;//可能接受来自调用程序的输入信息
info.RedirectStandardOutput = false;//由调用程序获取输出信息
info.RedirectStandardError = false;//重定向标准错误输出
info.CreateNoWindow = false;//不显示程序窗口
Process AppProcess = System.Diagnostics.Process.Start(info);
AppProcess.WaitForExit();
}
2、运行控制台程序,可以看到已经将程序目录下的test.mp4视频以RTSP形式推送至EasyDarwin,我们看下流媒体服务器EasyDarwin的运行情况:
可以用VLC查看实际播放效果,如下图:
如果有用户想了解我们的开源项目,可以进入EasyDarwin了解,并且经过多年的经验积累,我们已经研发出了基于EasyDarwin衍生的EasyNVR、EasyDSS等视频平台,大家均可了解。如有疑问,欢迎咨询。
版权声明
本文为[TSINGSEE]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4619556/blog/4710247
边栏推荐
- 分享用MathType编辑字母与数学公式的技巧
- [invite you to vote] who is the key driver behind these big open source events in 2020?
- Serilog 源码解析——Sink 的实现
- Installation and testing of Flink
- Talking about PHP file fragment upload from a requirement improvement
- Ubuntu18.04 NAT模式下配置静态IP地址 -2020.11.09
- Help enterprises to get rid of difficulties, famous enterprises return home Engineers: success depends on it!
- Application of pull wire displacement sensor in slope cracks
- In the third stage, day19 users echo packaged cookie products and remotely call Shopping Cart module crud operation
- 高质量的缺陷分析:让自己少写 bug
猜你喜欢
随机推荐
openocd+jlink_picture
.NET报表生成器Stimulsoft Reports.Net 发布最新版v2020.5!
Talking about PHP file fragment upload from a requirement improvement
设置背景图片的两种方式,并解决手机端背景图片高度自适应问题
Source code analysis of serilog -- implementation of sink
High quality defect analysis: let yourself write fewer bugs
[operation and maintenance thinking] how to do a good job in cloud operation and maintenance services?
Introduction to zero base little white Python
The database executes truncate table cm_ CHECK_ ITEM_ How does his recover
如何设计并实现存储QoS?
Git + -- Code hosting in the history of version management
Chrome浏览器 js 关闭窗口失效解决方法
电商/直播速看!双11跑赢李佳琦就看这款单品了!
Which industries are suitable for enterprises to develop wechat applet?
Kubernetes-17:Kubernets包管理工具—>Helm介绍与使用
Custom indoor map online tool
函数计算进阶-IP查询工具开发
Six axes of calibration service
Mit6.824 distributed system course translation & learning notes (3) GFS
Experts' interpretation of four hot industries in 2020 China telecom terminal technology and Standards Forum