Whether you simply want a server to act as a relay for you to be able to stream to multiple services at once, re-encode your video stream into different formats, resolutions, or bitrates, or to just stream from pre-recorded videos, a good method to do so is with a server running Nginx compiled with the RTMP module. Live streaming uses a lot of bandwidth.
The exact bandwidth uses depends on the number of streams, as well as their bitrate. Reducing the bitrate of the video encoding can reduce your bandwidth usage, at the cost of video quality. This configuration is enough to have the server accept a stream, but there are further configurations you can set for additional functionality. The only restriction in place is that each application must have a unique name. You can specify permissions for what IPs are able to stream to the server, as well as what IPs are allowed to play the stream from this server.
Otherwise, you can set a specific IP address. Examples: Allow Using this method, you can pass the received RTMP stream to a video processor, such as ffmpeg, for encoding. You can push the stream from an application to another receiver simply by using the push statement. You can do the same for any other platform that offers RTMP ingest addresses you can stream to, and can even list multiple push statements to essentially allow streaming to multiple platforms at once.
This will be the location the HLS. This new block should be as follows:. You can change the ports listed in the listen statements to any port you want to serve the video from. JS or PlayerJS. There are plenty of other configuration statements you can add to expand the functionality of the RTMP module of the Nginx configuration. The full documentation for what you can add and configure can be found here. You may consider using OBS as it is very powerful, has plugin support, popular with a large community, and open source.
The format for the server address should be as follows:. Providing a secret key that is unique will ensure that the stream itself is unique, even if other sources are streaming to the same application. Skip to content Hostwinds Guides. This guide uses CentOS 7 as the operating system of the server.Live video streaming is something becoming more and more popular on the Internet and platforms like Twitch or YouTube provide a infrastructure to consume endless hours of live and recorded media.
While these services provide a basic solution for free, they hold contents generally behind advertisements without a paid subscription. To have full control over your contents and thanks to open-source solutions it is easy to configure an own live streaming server that uses the RTMP protocol.
Log into the instance via SSH. All required packages for the basic server configuration are available via APT. Install nginx and the required packages:. This sets up the live streaming server as well as recording of the streams. It will ask for a password when streaming. If the password is not correct, the user will see a - Unauthorized message:. To broadcast a stream from a local computer to the streaming server, a broadcast system is required. Enter the Stream tab and enter the Information about your streaming instance: Server:.
The stream can be viewed in your favourite media player, for example VLC media player. It is also possible to rebroadcast a stream to platforms like Youtube, Facebook or Twitch to stream on multiple platforms at the same time.
Start broadcasting from OBS. You can now either view your stream via a media player like VLC, but also from broadcasting platforms like twitch:.
Scaleway Elements. Scaleway Dedibox. Scaleway Datacenter. Toggle navigation Scaleway Elements. Products New. Storage New. Technical Assistance. Customer Testimonials. By clicking or navigating this website site, you agree to allow our collection of information on Scaleway to offer you an optimal user experience and to keep track of statistics through cookies.
Everything works just fine, i am able to stream to server and then view the HLS stream in browser, however, the only way to do so is to enter the Stream Key as the target folder on the server to get the m3u8 file. Learn more. Asked 1 year, 1 month ago. Active 1 year, 1 month ago.
Viewed times. And thank you for your time! Ivan Zhivolupov. Ivan Zhivolupov Ivan Zhivolupov 7 7 silver badges 23 23 bronze badges. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Programming tutorials can be a real drag. Featured on Meta. Community and Moderator guidelines for escalating issues via new response….
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account. When I insert that URL paired with my streaming key in my nginx. This module is very efficient compared to alternatives solutions I found ffmpeg.
How to use RTMP and RTMPS with NGINX on Windows
I've just seen the same JosueAChavez and started panicking. I am using nginx on a raspberry pi to push streams to facebook live and wondering how to do this after 1st May I understand at this time that nginx does not support RTMPS however from doing some searching, it looks like you can use stunnel somehow.
This looks above my level so I am reluctant to try it on my raspberry pi server. Lax, I had been reading about stunnel but couldn't figure out how to configure it.
Thank you so much for the tutorial!!! I'll give it a shot! One question: Since nginx is listening on portdoesn't stunnel need to be listening to a different port since they are running on the same machine? I have had a look at this article and I don't understand how it works. Does anyone have any idea? For my testing, right or wrong, I chose port an unused AppleTalk port for stunnel to listen on.
I run nginx and now stunnel on a ubuntu ForrestScott That's ace I'll give that a go. I got a bit confused during one tutorial it was talking about setting up a certificate from the client side.
Do you know it stunnel sorts all that out for you.
Also, how do you sent the rtmps feed instead of the rtmp address? HI, I'm trying this on a windows machine. Any idea on the configuration to work properly on stunnel? But I do wonder about that.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I would like to be able to stream into NGINX and then on-the-fly use FFmpeg to transcode the stream to comply with the streaming site I intend to broadcast to, for example Twitch. However, when I'm on Twitch's inspector site to see if my stream is coming thorugh, I'm not receiving anything.
If someone could shed some light of where I might be going wrong please that would be greatly appreciated. From here I want to encode the one stream derived from OBS into several smaller bandwidth streams so that I can comply with streaming service's requirements such as Twitch and Mixer for example. Another question I have is, can the FFmpeg parameters be put on separate lines or do they have to all in one line? X will also pick the best level automatically. Learn more. Asked 2 months ago. Active 2 months ago.
Viewed times. Active Oldest Votes.
Streaming Video on Demand with nginx and RTMP Module
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.Using Nginx + RTMP + HLS to livestream to a webpage with kaffaltii253a.pw ▶️
The Overflow Blog. Podcast Programming tutorials can be a real drag. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow.
You can change this to a different directory but make sure that nginx have write permissions. Change it to reflect your path. In order to do so add a pull directive under application section in nginx. Read on more available options here. To achieve the stream encoding and muxing we will use the almighty ffmpeg. There are several source from which you can produce an rtmp stream. Now that we are pushing our stream into nginx, a manifest file in the format stream-name.
Now that we are pushing an HLS stream into nginx, we need to make the most of your server capacity. To do this, add a P2P layer on top of your servers to maximize your site's scalability and ability to deliver high-quality video streams. Adding Peer5 on top of your nginx server will do all of this and more. Compile nginx with rtmp module 2. Create nginx configuration file 3. Start nginx 4. Take the server for a test run! Table of contents 1. Add Peers. It's being actively worked on and contains more fixes and improvements over the original one Clone nginx-rtmp-module 1.Download the Nginx source code and extract it from the archive.
At the time when we are writing this blog post, the current version is 1. This configuration is suggested by the documentation of the RTMP module. To be able to see some nice statistics about the streaming, we must to copy stats. Below we will show how to use Flowplayer to achieve this.
First we need to download flowplayer. Of course the solution presented in the post above is minimalist and if you need to scale globally with your Video on Demand product, probably you need a CDN solution.
Yoga: Please share some more information about you Nginx configuration, without that it is hard to help you. Maurits i only follow this tutorial. Razvan Tudorica : maybe i should try the HLS streaming. Maybe with htaccess or whatever…. Thanks for a post. I have setup nginx with the rtmp-module on an Ubuntu machine.
Right now my rtmp section looks like this and works perfect:. Instead I want to hold it at least with a black screen, image or better, to play randomly local files from the server. Now I have for testing purposes a. Could you maybe help me out on this one? If the streamer disconnects it plays again randomly files from the above folder. Tim: Thanks for your comment. It seems like you have a good setup already.
What player are you using? That is probably the way that I would go.