Jump to content
  • Announcement

    Welcome to M1GC

  • M1GC

NGINX/RTMP/FFMPEG live-streaming server


Recommended Posts

Creating Your own Private RTMP server for streaming

Your Private RTMP Streaming Server 

NGINX/FFMPEG-based Media Streaming Server


  • RTMP/HLS/MPEG-DASH live streaming
  • RTMP Video on demand FLV/MP4, playing from local filesystem or HTTP
  • Stream relay support for distributed streaming: push & pull models
  • Recording streams in multiple FLVs
  • H264/AAC support
  • Online transcoding with FFmpeg
  • HTTP callbacks (publish/play/record/update etc)
  • Running external programs on certain events (exec)
  • HTTP control module for recording audio/video and dropping clients
  • Advanced buffering techniques to keep memory allocations at a minimum level for faster streaming and low memory footprint
  • Proved to work with Wirecast, FMS, Wowza, JWPlayer, FlowPlayer, StrobeMediaPlayback, ffmpeg, avconv, rtmpdump, flvstreamer and many more<
  • Statistics in XML/XSL in machine- & human- readable form


  • X2 PC's - One for Broadcasting / One for Streaming for Best Results.
  • If you only have X1 PC - System must have enough resources to support Broadcasting / Streaming, including running virtualization technology and virtual machines.
  • Ubuntu OS (May work on other Operating Systems with command modifications)

  • Multi-core CPU for FFMPEG / 2GB RAM Minimum / 4GB+ or more Recommended

  • Disk space as required for any media files or recordings...

  • PLEASE NOTE: You can also try our Docker Version which may save you some resources and time.

The Tutorial below will describe for both x1 or x2 pc / server setups..

Setting up the RTMP Streaming Server on 2nd Streaming PC or VM



You can run a 2nd Operating System / system on your main computer you use by utilizing virtualization:
VMWare Workstation (Paid) or VirtualBox (Free) or Docker (Free)

You may also use Cloud Providers such as Digital Ocean, AWS, Google Cloud, Microsoft Azure or M1-Serverz VPS to create a machine but may be costly..
We recommend having enough CPU, Memory, & Bandwidth Resources to achieve stable streaming on the same PC.  

If you do not know how to install Ubuntu Server to VMWare WorkstationVirtualBox, & Docker,

Check the links below:

Purchase: VMWare Workstation

Download: Virtualbox

Download Docker Desktop


Download Ubuntu Server OS Latest

Once your Virtualization Software is installed, & you have created a VM (Virtual Machine) with the latest Ubuntu Server operating system on your VM,

Login to your Ubuntu Server System. 
Install SSH on your Ubuntu Server

apt install ssh openssh-server -y

(You can now use Putty to SSH into your VM - Example: yourubuntuusername@yourlocalorexternalip )

User is logged in as root. (Not Recommended)

During this example, i am logged in a root.

To login as root user:

sudo su

We recommend using a standard user without administrator permissions for best security.

  • If logged in as root - You do not need to add sudo to every command.
  • If logged in as a user - add sudo to all commands below (Example: sudo apt install ffmpeg )

Installing FFmpeg on Ubuntu Server (Optional)


FFMPEG is back in Ubuntu.

Ubuntu Server now comes with FFMPEG by default in its repositories. 

Therefore, to install it, You only need to run:

apt -y install ffmpeg

Next, verify the installation with the following terminal command:

ffmpeg -version

If you wish to compile FFMPEG from source to use the latest version, follow this FFMpeg Compilation Guide.

Screenshot 2023-04-02 18431891.jpg

Compiling and installing NGINX with the RTMP module

You need to install the prerequisite libraries

Install the Prerequisite Libraries

apt install unzip zlib1g-dev wget vim-nox nano build-essential libpcre3 libpcre3-dev libssl-dev -y

Now you need to download the latest NGINX and the RTMP Module and unpack them
Check this link for NGINX latest mainline version.

wget https://nginx.org/download/nginx-1.23.4.tar.gz

wget https://github.com/MurderousOne/nginx-rtmp-module/archive/master.zip

tar -xvf nginx-1.23.4.tar.gz

unzip master.zip

cd nginx-1.23.4

Build NGINX with the NGINX-RTMP Module

Configure, Make, Make Install

./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master --with-debug --with-cc-opt="-Wimplicit-fallthrough=0"
make install

Configuring NGINX
Once Nginx is compiled,
The default location for the configuration file is: 

Edit the NGINX Configuration File

vi /usr/local/nginx/conf/nginx.conf


nano /usr/local/nginx/conf/nginx.conf

and at the end of the file, add the following:

rtmp {
    server {
        listen 1935;
        ping 30s;
        notify_method get;

        application live {
            live on;
        #push to restream.io
        push rtmp://live.restream.io/live/streamkey;


That's it.
Above the live application will publish a stream direct from your streaming software to any platform you listed as push.
in this case, it is sending a stream from my PC with OBS Studio, to the 2nc PC Streaming Server, which then sends the stream out to the platform listed.

Want to send more? Just add another push and send your stream to that platform as well.

rtmp {
    server {
        listen 1935;
        ping 30s;
        notify_method get;

        application live {
            live on;
        #push to restream.io
        push rtmp://live.restream.io/live/streamkey;
		#push to youtube
		push rtmp://a.rtmp.youtube.com/live2/streamkey;


PLEASE NOTE: You will require the same amount of bandwidth for both push streams.
If you use 6mbps to stream a 1080p60fps stream to one platform, it will require 12mbps of Upload Bandwidth for streaming to x2 platforms.

Using restream.io will save you on streaming to multi-platforms simultaneously. You can stream to 30+ platforms and only use 6mbps..
Adding additional push to platforms, will require additional upload bandwidth...
Be sure to speed test your upload speeds to test your networks full capabilities.

Running the server
You can start the nginx server manually by running the following command:


But we recommend you add it in your services for convenience.

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/nginx -O /etc/init.d/nginx
chmod +x /etc/init.d/nginx
update-rc.d -f nginx defaults

Start / Stop / Restart the NGINX server

service nginx start
service nginx stop
service nginx restart

Back out of NGINX FOLDER

cd ..

Download the above commands as shell scripts for easy executing.

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/upgrade

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/edit-rtmp

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/start-rtmp

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/stop-rtmp

wget https://raw.githubusercontent.com/MurderousOne/nginx-rtmp-ffmpeg-docker/main/restart-rtmp

Make the scripts executable

chmod +x upgrade edit-rtmp restart-rtmp start-rtmp stop-rtmp 

Cleaning up left over files and folders

These installation files are no longer needed and will reduce space on your server

rm -r master.zip nginx-1.23.3 nginx-rtmp-module-master nginx-1.23.3.tar.gz

Execute the shell commands
Start / Stop / Restart the NGINX server

Start the NGINX Server


Stop the server


Restart the server


Edit the rtmp server config 


Upgrade the software packages


Setting up the main broadcasting / streaming computer
Main broadcasting computer or Any ol PC Capable of running OBS Studio with x264 or NVENC encoding.

In OBS, i use NVENC encoding and I use my monitor’s native resolution (1080p). 

Using OBS Studio, in your broadcast settings you need to use the “Custom” streaming service.

Screenshot 2022-09-17 181741.jpg

NOTE: (You can use your servers local IP or External IP Address)

Your Stream Key needs to be the same you used in your nginx configuration. (Stream-Key is Case-Sensitive)

In the Encoding, use Nvidia NVENC (Since it doesn’t use a lot of CPU).

Click here for Live encoder settings, bitrates, and resolutions

You may need to reduce your bitrate depending on services bandwidth limits.
You may need to adjust your max bitrate according to your needs and capabilities

As for Audio encoding, I use the AAC codec, 96k bit rate and a Format of 44 or 48Khz.

That's it

You can now stream direct with your own lightweight private rtmp server, just like a restream.io, using your own bandwidth, but without the platform limit's.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • M1GC changed the title to NGINX/RTMP/FFMPEG live-streaming server
  • M1GC featured this topic
  • M1GC locked this topic
  • M1GC unlocked this topic
This topic is now closed to further replies.
  • M1GC

  • Welcome to M1GC


    We accept players of all skill levels and help members grow at their own pace.

    We are respectful, determined, and proud to be M1GC members..

  • twitch-logo.gif.6e366685b5d45bf948dad544bc71f521.gif

    Check out M1GC on Twitch

  • Sign up to Restream.io

    M1-Gaming Is Inviting you to Join Restream. The best way to stream video live to 30+ platforms simultaneously for free.

MuRdeR1 GaMinG CReW

We are a community of mature gamers who value character, honor, and professionalism

We are one of the newest active teams in online gaming.

We are diverse and open, with members from all across the world in multiple games.

M1GC Crew Gamers

We are organized and stable, with opportunities for both competitive and casual.
We accept players of all skill levels and help members grow at their own pace.

M1GC Crew Websites

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.