当前位置:网站首页>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
边栏推荐
- DCL单例模式中的缺陷及单例模式的其他实现
- Kubernetes权限管理之RBAC (一)
- Express yourself with wechat expression translation, programmer's little romance, get up quickly!
- 如何设计并实现存储QoS?
- Mit6.824 distributed system course translation & learning notes (3) GFS
- QML Repeater
- MIT6.824分布式系统课程 翻译&学习笔记(三)GFS
- iOS下带小数点的数字键盘
- 拉线式位移传感器在边坡裂缝中的作用
- 浅谈API网关(API Gateway)如何承载API经济生态链
猜你喜欢

知识图谱描边1.1——从NER上手

第三阶段 Day19 用户回显 封装Cookie 商品远程调用 购物车模块 CRUD操作

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

Mit6.824 distributed system course translation & learning notes (3) GFS

自定义室内地图在线工具

解析:C++如何实现简单的学生管理系统(源码分享)

校准服务的六个轴心

On agile development concept and iterative development scheme

明年起旧版本安卓设备将无法浏览大约30%的网页

零基础小白python入门——深入Python中的文件操作
随机推荐
校准服务的六个轴心
Help enterprises to get rid of difficulties, famous enterprises return home Engineers: success depends on it!
Serilog 源码解析——Sink 的实现
解析:C++如何实现简单的学生管理系统(源码分享)
单链表反转
How about Tencent cloud amd cloud server?
How to choose the development of Biao fan interactive interpretation program?
浅谈API网关(API Gateway)如何承载API经济生态链
High performance library dpdk concise understanding
[share] interface tests how to transfer files in post request
How to design and implement storage QoS?
iOS下带小数点的数字键盘
Super discount, cloud server 88 yuan seconds
In depth analysis of the multi-user shopping mall system from search to create a profit point
会展云技术解读 | 面对突发事故,APP 如何做好崩溃分析与性能监控?
超简单集成华为系统完整性检测,搞定设备安全防护
In depth analysis of the multi-user shopping mall system from search to create a profit point
Chrome浏览器 js 关闭窗口失效解决方法
Looking for a small immutable dictionary with better performance
手势切换背景,让直播带货更加身临其境