Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created March 30, 2020 16:21
Show Gist options
  • Save remyleone/ab63db1477e7f23fa0164b73d201313d to your computer and use it in GitHub Desktop.
Save remyleone/ab63db1477e7f23fa0164b73d201313d to your computer and use it in GitHub Desktop.
ffmpeg / rtmp streaming
#
# nginx configuration
#
load_module "/usr/local/libexec/nginx/ngx_rtmp_module.so";
worker_processes 10;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use kqueue;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
server {
listen 8080;
server_name localhost;
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /usr/local/www/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
}
rtmp {
server {
listen 1935;
ping 30s;
notify_method get;
application plop {
live on;
allow publish 192.168.1.0/24;
allow play all;
}
}
}
#
# ffmpeg command
#
ffmpeg -re -i Movie.x264.mkv -c:v copy -c:a libmp3lame -ar 44100 -ac 1 -f flv rtmp://192.168.1.2/plop/stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment