How to Create Your Own Video Streaming Server with Linux?

Arkadeep Deb
3 min readOct 7, 2021

Can you imagine a video streaming service where you are not bound by any third-party Terms of Service, advertisements, or audience limitations? With Linux, you can not only imagine but create your own video streaming server in real-time! Creating your video streaming server, with Linux can be the start of a fun project; and, you can even scale it into a viable business product.

But, before it gets to that point, we must educate ourselves first in the basics.

create_your_own_video_streaming_server_with_linux
Photo by Ralston Smith on Unsplash

What is a video streaming server?

A Linux-based video streaming service can help stream video with encoded audio, using Real-Time Messaging Protocol (RTMP) or WebRTC (Web Real-Time Communication). Depending on the server infrastructure at your disposal you can control the quality of your playback while curbing streaming challenges, such as latency and buffering.

There are two benefits to launching your video server:

  1. You can directly generate revenue with independent broadcast content.
  2. It gives you independence over your audience demographic and content preferences.

So, let us roll up our sleeves, and learn how to set up the video streaming service.

Step 1- Decide before building the streaming service:

Before building the service, you must consider a few factors.

  • Streaming quality

Do you want to broadcast streams in high-definition or standard definition

  • Viewership

How many viewers do you want to support your service?

  • Storage

What kind of storage systems do you have for storing your content?

  • Access

Do you want to stream to a select few or anybody in the public?

  • Media recording capabilities

Do you want to enable the recording of your streams?

Step 2- The Linux server setup

  1. Download and install Ubuntu and configure it for a static network
  2. Reboot and check for updates with:

sudo apt update

sudo apt upgrade

3. Install the Nginx server:

sudo apt install nginx

For this method, we are opting RTMP. Download the RTMP module for the media stream:

udo add-apt-repository universe

sudo apt install libnginx-mod-rtmp

4. Configure Nginx for delivering the media stream:

sudo nano /etc/nginx/nginx.conf

5. Add these lines to the end of the configuration file:

tmp {

server {

listen 1935;

chunk_size 4096;

application live {

live on;

record off;

}

}

}

6. Save the configuration file and restart Nginx:

sudo systemctl restart nginx

Step 3- Setting up the streaming application

  1. Download Open Broadcaster Software for Linux and declare your hardware configurations.
  2. In OBS, click the + symbol under Sources to add your streaming source.
  3. Click File and choose Settings.
  4. In the Stream section, select Set Stream type to Custom, and enter:rtmp://IPaddress/live
  5. Add the IP address of your streaming server in the corresponding field.
  6. Generate a unique stream key.
  7. You can add a recording function to your stream with:

application live {

live on;

record all;

record_path /var/www/html/recordings;

record_unique on;

}

To test, just fire up an RTMP media player, such as VLC Media Player, and add the network stream key in the format:

rtmp://IPaddress/live/SecretKey

You may additionally integrate a CDN so users can experience faster content delivery thanks to proxy servers. Thus, with some basic Linux commands you have learned to launch a DIY streaming service, in no time. Happy streaming!

--

--

Arkadeep Deb

Freelance Content Developer with 10+ years of experience in content development for various niches.