Skip to content

Instantly share code, notes, and snippets.

@teocci
Created June 25, 2019 08:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocci/68d7c867de180c09f3ccf2f0c4a996e5 to your computer and use it in GitHub Desktop.
Save teocci/68d7c867de180c09f3ccf2f0c4a996e5 to your computer and use it in GitHub Desktop.
Nginx RTMP Setup
rtmp {
access_log /var/log/nginx/rtmp_access.log;
server {
listen 1935;
ping 30s;
notify_method get;
application camera1 {
live on;
exec_pull ffmpeg -i rtsp://admin:admin@10.10.10.11/axis-media/media.amp -threads 2 -f flv -r 25 -s 1280x720 -an rtmp://localhost:1935/cam1/stream 2>>/var/log/nginx/ffmpeg.log;
}
}
}
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.php index.html index.htm;
}
location /live {
types {
application/vnd.apple.mpegurl m3u8;
}
alias /home/hls/live;
add_header Cache-Control no-cache;
}
location /dash {
alias /home/dash/live;
add_header Cache-Control no-cache;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 8192;
application live {
live on;
allow publish 127.0.0.1;
allow publish all;
allow play all;
record all;
record_path /home/video_recordings;
record_unique on;
hls on;
hls_nested on;
hls_path /home/hls;
hls_fragment 10s;
dash on;
dash_path /home/dash;
dash_nested on;
}
# Video on Demand
application vod {
play /home/vod;
}
# Restream
application restream {
live on;
# push server1:1935
# push server2:1935
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment