ffmpeg+EasyDSS streaming media server to achieve stable rtmp live streaming

This article is transferred from the blog of Alex, a member of the EasyDarwin team: http://blog.csdn.net/cai6811376/article/details/74783269

need

When doing EasyDSS development, we are always testing the streaming effect.

Of course, you can use libEasyRTMP for push streaming testing.

Sometimes, we want to use OBS for push testing, that's fine too.

And other RTMP streaming tools.

But don't forget, there is also the artifact ffmpeg. ffmpeg can get various video streams and push them to the EasyDSS RTMP streaming server.

For example, to pull the camera RTSP stream and push it to EasyDSS, the command is here

 ffmpeg -i rtsp://username:password@ip:port/xxxxxxx -vcodec copy -acodec copy -f flv -y rtmp://easydssip:easydssport/live/test

Of course, this command is limited to the code stream provided by the camera is H.264+AAC, if not

will be -vcodec copychanged -vcodec libx264to-acodec copy-acodec aac

If so, we want to use ffmpeg to read files for RTMP push, of course, you can choose OBS, but, after all, ffmpeg is lighter than OBS, the command is here

 ffmpeg -i test.h264 -vcodec copy -acodec copy -f flv -y rtmp://easydssip:easydssport/live/test

-vcodec and -acodec are changed as needed to pull RTSP streams.

This satisfies our desire to push files to EasyDSS.

but. . . . .

The effect of ffmpeg streaming is often unsatisfactory, and various problems such as slow playback, asynchronous audio and video, and unstable HLS live broadcast often occur?

solve

Of course there is a solution

 ffmpeg -re  -stream_loop -1 -i test.h264 -vcodec copy -acodec copy -f flv -y rtmp://easydssip:easydssport/live/test

added one-re

What is this for?

https://ffmpeg.org/ffmpeg-all.html#Main-options

We understand that -re means re-adjusting the timestamp, so that the uneven timestamps of various files, RTSP sources, and RTMP sources can all be re-adjusted by ffmpeg, and then rtmp streaming can be performed to ensure smooth live broadcast and hls slices of uniformity.

In addition, when pulling the RTSP stream, try to add the -rtsp_transport tcp option to ensure the stability of the data source and no packet loss!

EasyDSS streaming server recommendation

EasyDSS commercial streaming media server provides one-stop transcoding, on-demand, live broadcast, and time-shift playback services, which greatly simplifies development and integration work, and EasyDSS supports a variety of features, which can fully meet the needs of enterprise video informatization construction :

①Multi-screen playback: Support Flash, HTML5 playback, compatible with Windows, Android, iOS, Mac and other operating systems.

②Free combination: EasyDSS software products are seamlessly connected, and EasyDSS streaming media server software can also be connected with other third-party platforms, and the combination is flexible and free.

③Support cloud architecture: Support Alibaba Cloud, Tencent Cloud, Huawei Cloud, Qingyun, Qiniu Cloud Storage and other major cloud service providers, support cloud architecture, and more flexible deployment.

④Seamless connection with CDN: EasyDSS software products support seamless connection with CDNs such as Wangsu, Dilian and Lanxun.

⑤Simple secondary development: Provides a programming language-independent RESTful API interface. As long as you understand any of the development languages ​​such as JS, HTML, JAVA, ASP.NET, PHP, and ASP, you can use the RESTful API provided by EasyDSS to perform secondary development. secondary development.

⑥Easy to use: Graphical operation, clear modules, simple process, and easy to use.

How does EasyDarwin support VOD and RTMP/HLS live broadcast? EasyDSS!

More EasyDSS advanced features: www.easydss.com

Get more information

Email: [email protected]

WEB:www.EasyDarwin.org

QQ exchange group: 587254841

Copyright © EasyDarwin.org 2012-2017

EasyDarwin

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324820001&siteId=291194637