当前位置:网站首页>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
边栏推荐
- 程序模拟感知机算法(梯度下降法、sklearn.linear_model中perception方法)
- How to implement a simple student management system with C + +
- 企业公司开发微信小程序适用于哪些行业?
- MIT6.824分布式系统课程 翻译&学习笔记(三)GFS
- How the API gateway carries the API economic ecological chain
- Git + -- Code hosting in the history of version management
- 第三阶段 Day20 购物车模块实现 添加拦截器 添加用户权限校检 实现订单模块
- 帮助企业摆脱困境,名企归乡工程师:能成功全靠有它!
- Visualization construction of CIM platform
- The latest version of pycharm 2020.3: pair programming, intelligent text proofreading and downloading experience
猜你喜欢

Avoid pitfall guide for cloud integration - Android push

It's so easy to replace the video background with the sound and shadow

拉线式位移传感器在边坡裂缝中的作用

详解Git

浅谈API网关(API Gateway)如何承载API经济生态链

Do you think it's easy to learn programming? In fact, it's hard! Do you think it's hard to learn programming? In fact, it's very simple!

标梵互动解说小程序开发该如何选择?

Installation and testing of Flink

浮点数之间的等值判断

Gesture switch background, let live with goods more immersive
随机推荐
单链表反转
Ultra simple integration of Huawei system integrity testing, complete equipment security protection
手势切换背景,让直播带货更加身临其境
Learning notes of millet mall, day 5: ES full text search
Colleague notes - small program entry point
Configure static IP address in ubuntu18.04 NAT mode -2020.11.09
融云集成之避坑指南-Android推送篇
揭秘在召唤师峡谷中移动路径选择逻辑?
Git + -- Code hosting in the history of version management
会展云技术解读 | 面对突发事故,APP 如何做好崩溃分析与性能监控?
用微信表情翻译表白,程序员的小浪漫,赶紧Get起来!
电商/直播速看!双11跑赢李佳琦就看这款单品了!
帮助企业摆脱困境,名企归乡工程师:能成功全靠有它!
The latest version of pycharm 2020.3: pair programming, intelligent text proofreading and downloading experience
CentOS查看CPU核心数及cpuinfo解析
脑机接口先驱炮轰马斯克:“他走的是一条死胡同,说的话我一个字都不同意”
Express yourself with wechat expression translation, programmer's little romance, get up quickly!
[God level operation] analyze the Ninja code with the traditional Chinese thoughts of Confucius and Laozi!
Openocd-jtag debugging
5分钟GET我使用Github 5 年总结的这些骚操作!