Create Your Own Live Video Streaming Server With Linux
Gives you more control over your system and content
Most live streaming tools and sites are free to the public but they often tend to require that you create an account, providing information you may not wish to appear online. Theycanhold some content behind advertisements and incorporate confusing Terms of Service that they may not even stick to themselves.
There are those who enjoy the ability to stream live, but don’t have a need to have their videos be available to the masses. Instead, they’d prefer to have more control over their stream and the content they produce. Open-source software, like Linux, is the best answer to this obstacle.
Thinking Ahead
Before you begin setting up your own personal streaming server, you should ask yourself a few questions. First, what quality of stream are you looking for? Next, how many viewers do you expect to pull in? Where will you store all of your streamed content? Who will have access to that content?
System requirements can also be seen as a concern. However, there are no set rules on exactly what you’ll need in this regard, so do yourself a favor and experiment to see what works best for your goals.
You’ll need to figure out which protocol will handle the audio and video portion of the streaming. Real-Time Messaging Protocol (RTMP) is a great choice but there are others, such as WebRTC, that might fare better in your situation. RTMP has broad support so we’ll focus on that for this article.
Another thing to worry about is likely delays in your “live” streaming. Just because you go live doesn’t mean that everything will line up perfectly. Video streams need to be encoded, transferred, buffered, and displayed, so expect the need for a bit of tweaking in the stream’s attributes.
Linux Server Setup
Ubuntu Linux is my personal favorite, so that will be the version of choice here. For those who prefer a GUI option,Ubuntu Desktopis available.
We’ll be usingNginx web serverfor this streaming server. Install it:
Procure the RTMP module so Nginx can handle your media stream:
Adjust Nginx’s configuration so that it can accept and deliver your media stream.
Add the following code to the bottom of the config file:
rtmp {server {listen 1935;chunk_size 4096;application live {live on;record off;}}}
Save the config file as we’ll be using it later to create a working streaming server.
Restart Nginx with its new configuration:
Streaming Software Setup
The server is ready, so now it’s time to set up your streaming software. Let’s useOpen Broadcaster Software(OBS) in this run-through.
In the Stream section, selectset Stream Type to Custom…and enter the following URL into the Server field:
In place ofIPaddress, enter the IP address of your streaming server.
Now create your own Stream Key and enter it into the Stream key box. Make it something you’ll remember and write it down. For added security, check theUse authenticationbox and add your preferred credentials.
Finish withApplyfollowed by theOKbutton.
Everything should now be configured for streaming. To begin your first stream, hit theStream Nowbutton.The button will change toStop Streamingso long as everything was done correctly. Your stream’s bandwidth metrics will appear at the bottom of the OBS window.
Be Your First Viewer
There are plenty of open source media players that support RTMP, the most well-known of which isVLC media player. Install and launch this software, click theMediatab, and selectOpen Network Streamfrom the menu.
Got your Stream Key handy? Type the path to your stream, and include the Stream Key you set up earlier, to the end of it. Should look like:
ClickPlayand you’ll get a live view of your very own stream.
Additional Measures
Now that the basics have been achieved, limiting access to your streaming server and being able to record and save your videos are two other factors you may be interested in.
By default, anyone can view your stream. This may go against the purpose of creating the server in the first place. You’ll want to set up limited access using a Linux firewall,.htaccess file, or thebuilt-in access controls in the RTMP module. This choice is left up to you.
The Nginx configuration provided here will only enable you to stream videos, but not save them. To add a storage option, in the Nginx config, just below the RTMP section, you can set up the stream recording options and provide a location to where you want your content saved and stored.
Set an existing path in order to allow Nginx to write to it. Enter the following:
application live {live on;record all;record_path /var/www/html/recordings;record_unique on;}
That’s all you should need when setting up a live streaming server using the Ubuntu Linux OS. If you’re more interested in a non-live media streaming server, I would suggest the use ofPlexin place of OBS.
Former US Army IT communications specialist who began his online blogging career in 2016. Joseph has over 10 years experience in the IT industry as both an analyst and communications expert. He’s a night owl and an avid Red Bull consumer who spends most of his downtime enthralled by online gaming and website building.Read Joseph’s Full Bio
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved