当前位置:网站首页>C console calls ffmpeg to push MP4 video file to stream media open source service platform easydarwin process

C console calls ffmpeg to push MP4 video file to stream media open source service platform easydarwin process

2020-11-09 17:46:00 TSINGS

I wrote a popular science article before 《 How to use RTSP Push flow components EasyPusher take MP4 File pushed to EasyDarwin Open source platform 》, In this article , We tried to pass EasyPusher take MP4 File pushed to EasyDarwin, But in addition to this method , We have other ways to MP4 File push to EasyDarwin On .

This article will share with you C# The console calls FFMPEG PUSH MP4 Video files to streaming media open source service platform EasyDarwin The process .

1、 Create a new console application project , Will download okay FFMPEG Put it under the program root , Here's the picture :

65.png

stay main Write the following code in the function :

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;// May accept input from the caller 
            info.RedirectStandardOutput = false;// Get the output information from the calling program 
            info.RedirectStandardError = false;// Redirect standard error output 
            info.CreateNoWindow = false;// Don't show program window 
            Process AppProcess = System.Diagnostics.Process.Start(info);
            AppProcess.WaitForExit();
 
        }

2、 Run the console program , You can see the program directory in the test.mp4 Video with RTSP Push the form to EasyDarwin, Let's look at streaming servers EasyDarwin Operating condition :

66.png

It can be used VLC Check the actual playback effect , Here's the picture :

67.png

If there are users who want to know about our open source projects , Can enter the EasyDarwin understand , And after years of experience , We've developed a system based on EasyDarwin Derivative EasyNVR、EasyDSS Wait for the video platform , You can all understand . If you have any questions , Welcome to consult .

版权声明
本文为[TSINGS]所创,转载请带上原文链接,感谢