HLS Streaming Server with NGINX

  • 797 views. Added .

Want to make your own streaming server so you can deliver live HTTP video to your website? Grab a VPS and strap in, because it's easier than you might think!

Affiliate links for DigitalOcean and Linode:
https://digitalocean.nots.co
https://linode.nots.co

Guide used as a reference for this video (not comprehensive): https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/

Currently-maintained NGINX RTMP module fork: https://github.com/sergey-dryabzhinsky/nginx-rtmp-module

Comments (log in to post)

Hi Jacob,

Excellent tutorial!  Quick question, still having an issue with sending the HLS data into my web site, the player keeps going into a loading loop after hitting 'play'.  RTMP seems to be working, able to open the stream in VLC (rtmp://mydomain:8080/show/live.m3u8).   Do I need to add anything under the http or HLS/application sections of the nginx.conf or could I be missing something else?

Ubuntu: 18.04
Nginx: 1.14 (hosting both www and rtmp)
VPS: AWS

Thanks in advance for your help and stay safe.

P.
I would assume you need to be able to play back the m3u8 feed using http:// or https:// (whichever your website is using) and without specifying port 8080:. You need to add the things under the http section that I added in this video. A web browser needs to be able to visit the .m3u8 link and download the m3u8 manifest. If it can, then a video player should be able to play the video back as well.
Thanks a lot Jacob, it is working now.
Hello
Nice tutorial.
Do you have some similar stream solution, for webrtc?
Good afternoon Jacob, I hope you are well.

I tell him I managed to implement my HLS server, and now that I buy a decoder to see the transmission that is sent to the server through RTMP, the decoder does not connect to the server since it only recognizes formatted addresses:

example:
transmission link: rtmp: //rtmp.mine.com.cn/live/0315
reproductor link: rtmp: //pay.mine.com.cn/live/0315

Do you think there was a solution?
Hi there!

marpensa said

now that I buy a decoder to see the transmission
Why do you need to buy a decoder? ffmpeg is the encoder, NGINX is the transcoder, the web browser is the decoder. All major web browsers are currently able to play HLS, and even the ones that can't natively can do so through a video player like VideoJS.

marpensa said

example:
transmission link: rtmp: //rtmp.mine.com.cn/live/0315
reproductor link: rtmp: //pay.mine.com.cn/live/0315
"Reproductor" is not an English word, but I get the idea. However, your playback URL is not going to start with rtmp:, it's going to start with http: or https: (hence, why it's called HTTP Live Streaming) and it's going to end with .m3u8. You can play back the RTMP URL using a player that can decode RTMP, but the point of this video and the setup I demonstrated was to have NGINX decode it into HLS so clients can watch directly. Does that make sense? If not, then I'd need some more clarification on what you're trying to accomplish.