Skip to content

Instantly share code, notes, and snippets.

@DevStefIt
Created February 9, 2023 08:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevStefIt/23b8971db7e3fe084d29f2c915fb7773 to your computer and use it in GitHub Desktop.
Save DevStefIt/23b8971db7e3fe084d29f2c915fb7773 to your computer and use it in GitHub Desktop.
A list of commands to configure a Nginx server to send data through RTMP
# All the commands have been tested on a Xubuntu 22.04
# First we update our machine
sudo apt update
sudo apt upgrade
# We install the Nginx server
sudo apt install nginx
# We test and enable the firewall if it is disabled
sudo ufw status
sudo ufw enable
sudo ufw status
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw status
# We check if Nginx is enable system-wide
systemctl status nginx
# We install the Nginx RTMP module
sudo apt install libnginx-mod-rtmp
# We open the nginx.conf file and update it with the RTMP configuration
sudo vim /etc/nginx/nginx.conf
# These are the lines to add at the end of the file
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish 127.0.0.1;
deny publish all;
application live {
live on;
record off;
}
}
}
# We enable the RTMP port (1935/TCP)
sudo ufw allow 1935/tcp
sudo ufw status
# We reload Nginx system-wide
sudo systemctl reload nginx
# The command to run on the server
ffmpeg -re -i INPUT_FILE -c:v libx264 -c:a aac -preset ultrafast -tune zerolatency rtmp://localhost/live/bbb
# The command to run on the client. Edit with the IP address of your own machine
{ffplay|mpv} rtmp://SERVER_IP_ADDRESS/live/bbb
@DevStefIt
Copy link
Author

These are the command shown in the video.
If you have other things to add, don't hesitate at shooting a comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment