- Install FFMPEG
- Setup rtmp application for restream
- Test
Last active
November 24, 2020 13:56
-
-
Save caffeinum/6edf80e3c7820f66c269cfa4c4a0982e to your computer and use it in GitHub Desktop.
RTMP Server Basic setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rtmp { | |
server { | |
listen 1935; | |
chunk_size 4096; | |
application studio107 { | |
live on; | |
} | |
application mirror { | |
live on; | |
} | |
application live { | |
live on; | |
record off; | |
} | |
# TODO: other applications: restream, repack | |
# Dynamic Youtube | |
application a-youtube { | |
live on; | |
exec_push ffmpeg \ | |
-i rtmp://localhost/$app/$name \ | |
-c copy \ | |
-f flv rtmp://a.rtmp.youtube.com/live2/$name; | |
} | |
application x-youtube { | |
live on; | |
exec_push ffmpeg \ | |
-i rtmp://localhost/$app/$name \ | |
-c copy \ | |
-f flv rtmp://x.rtmp.youtube.com/live2/$name; | |
} | |
} | |
} |
- После создания нового сервера установить nginx и пакет для rtmp
# from https://askubuntu.com/questions/1031953/nginx-rtmp-module-on-ubuntu-18-04#1034600
sudo apt update
sudo apt install nginx-core nginx-common libnginx-mod-rtmp
sudo service nginx restart
- Добавить в конец
/etc/nginx/nginx.conf
:
include /etc/nginx/rtmp.conf;
- Создать файл
/etc/nginx/rtmp.conf
sudo vim /etc/nginx/rtmp.conf
с содержимым из rtmp.conf (ниже на странице)
- Настроить HTTPS
# update snap (optional)
sudo snap install core; sudo snap refresh core
# install certbot
sudo snap install --beta --classic certbot
sudo snap set certbot trust-plugin-with-root=ok
# issue certs
sudo certbot --nginx
-
Настроить папку в сайте default
-
Настроить rtmp_stylesheet директиву
-
Test at
/stat
location -
Скачать stat.xsl из репозитория: https://raw.githubusercontent.com/arut/nginx-rtmp-module/master/stat.xsl
-
Положить в корень сайта, например:
# sites/default
root /var/www/static;
# RTMP
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /var/www/static;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment