VLCome the Player

2026-04-28, Tue

So how to set up a RTMP server to stream video in local network? There are three steps to take:

  1. install and configure the RTMP server
  2. stream video to the server (be it existing video files, or live stream)
  3. view the video stream in VLC

Let's take them one by one.

1. Set Up RMTP Server

Take nginx as example, install it along with the RTMP module

sudo dnf update
sudo dnf install nginx libnginx-mod-rtmp

Edit /etc/nginx/nginx.conf to set up an RTMP application:

rtmp {
  server {
    listen 1935; # default RTMP port
    chunk_size 4096;
    application live { # or any other name
      live on;
      record off;
    }
  }
}

After config file change, restart the nginx server

sudo systemctl restart nginx

2. Stream Video to Server

Two types of video could be sent to the RTMP server: video file or live stream.

2.1. Stream Video Files

For existing video files, use ffmpeg to get it done

ffmpeg -re -i "video_file.mp4" -c:v copy -c:a aac -f flv rtmp://localhost/live/stream

ffmpeg options used here are explained below

-re
read the input at its native frame rate
-c:v copy
copy the video sream without re-encoding
c:a aac
set the audio codec
-f flv
set the output format required by RTMP

The live in RTMP URL corresponds to the application name in /etc/nginx/nginx.conf.

Note that OBS Studio (see below) could also be used to play existing video files into the RTMP server: simply add a Media Source and click Start Streaming.

2.2. Live Streaming

This could be done by OBS Studio.

  1. Open OBS Studio and go to Settings -> Stream
  2. Set Service to Custom
  3. Enter the Server URL: rtmp://localhost/live (or local IP address if streaming from another device)
  4. Enter a Stream Key: e.g. mec-video, and click OK
  5. Click Start Streaming to send the live stream video to RTMP server

3. Play Video in VLC

Now open VCL Media Player and go to Media -> Open Network Stream, enter the full RTMP URL that includes both RTMP application name and stream key, e.g. rtmp://localhost/live/mec-video, or in the case of local server: rtmp:local_server_ip/live/mec-video, and click Play.

4. Caveats

Ensure that port 1935 (the default RTMP port) is open in server's firewall settings.

5. References