#user nobody; worker_processes auto; #worker_processes 1; #access_log logs/access_nginx.log main; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 4096; multi_accept on; use epoll; } rtmp_auto_push on; rtmp { server { listen 1935; # chunk_size 4096; chunk_size 8192; # chunk_size 12288; application myapp { live on; hls on; record off; # record all; record_path /home/sda3/record; record_suffix _app1-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; record_interval 15m; hls_path /tmp/hls; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/dash; dash_fragment 6s; } # ------------------------- application app2 { live on; hls on; record off; # record all; record_path /home/sda3/record; record_suffix _app2-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; record_interval 15m; hls_path /tmp/hls/720p; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/d720p; dash_fragment 6s; # exec_static /usr/local/src/ffmpeg/ffmpeg/ffmpeg -hwaccel cuda -hwaccel_device 0 -i rtmp://localhost/myapp/live -vf "scale=1280:720" -c:v h264_nvenc -b:v 3500k -acodec copy -f flv rtmp://localhost/app2/live; } # ------------------------- application app3 { live on; hls on; record off; # record all; record_path /home/sda3/record; record_suffix _app3-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; record_interval 15m; hls_path /tmp/hls/576p; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/d576p; dash_fragment 6s; # exec_static /usr/local/src/ffmpeg/ffmpeg/ffmpeg -hwaccel cuda -hwaccel_device 0 -i rtmp://localhost/myapp/live -vf "scale=1024:576" -c:v h264_nvenc -b:v 2500k -acodec copy -f flv rtmp://localhost/app3/live; } # ------------------------- application app4 { live on; hls on; # record all; record off; record_path /home/sda3/record; record_suffix _app4-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; # record_interval 3m; hls_path /tmp/hls/480p; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/d480p; dash_fragment 6s; # exec_static /usr/local/src/ffmpeg/ffmpeg/ffmpeg -hwaccel cuda -hwaccel_device 0 -i rtmp://localhost/myapp/live -vf "scale=854:480" -c:v h264_nvenc -b:v 2000k -acodec copy -f flv rtmp://localhost/app4/live; } # ------------------------- application app5 { live on; hls on; record off; # record all; record_path /home/sda3/record; record_suffix _app5-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; # record_interval 3m; hls_path /tmp/hls/360p; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/d360p; dash_fragment 6s; # exec_static /usr/local/src/ffmpeg/ffmpeg11/ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i rtmp://localhost/myapp/live -vf hwupload,scale_npp=1280:-1 -c:v h264_nvenc -b:v 3M -acodec copy -f flv rtmp://localhost/app2/live -vf hwupload,scale_npp=1024:-1 -c:v h264_nvenc -b:v 2M -acodec copy -f flv rtmp://localhost/app3/live -vf hwupload,scale_npp=854:-1 -c:v h264_nvenc -b:v 1M -acodec copy -f flv rtmp://localhost/app4/live -vf hwupload,scale_npp=640:-1 -c:v h264_nvenc -b:v 709k -acodec copy -f flv rtmp://localhost/app5/live; } # ------------------------- application app6 { live on; hls on; record off; # record all; record_path /home/sda3/record; record_suffix _app6-%Y-%m-%d-%H-%M-%S.flv; # record_max_size 5120K; record_interval 15m; hls_path /tmp/hls/app6p; hls_nested on; hls_fragment 6s; dash on; dash_path /tmp/hls/dapp6p; dash_fragment 6s; # exec_static ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i rtmp://localhost/app6/live -vf scale_vaapi=1920:-1 -c:v h264_vaapi -b:v 5M -acodec copy -f flv rtmp://localhost/myapp/live ; } # ------------------------- # exec_static /usr/local/src/ffmpeg/ffmpeg311223/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i rtmp://localhost/app6/live -vf "hwupload,fps=30,scale_vaapi=1920:-1:format=nv12" -c:v h264_vaapi -b:v 5M -acodec copy -f flv rtmp://localhost/myapp/live -vf "hwupload,fps=30,scale_vaapi=1280:-1:format=nv12" -c:v h264_vaapi -b:v 3M -acodec copy -f flv rtmp://localhost/app2/live -vf "hwupload,fps=30,scale_vaapi=1024:-1:format=nv12" -c:v h264_vaapi -b:v 2M -acodec copy -f flv rtmp://localhost/app3/live -vf "hwupload,fps=30,scale_vaapi=854:-1:format=nv12" -c:v h264_vaapi -b:v 1M -acodec copy -f flv rtmp://localhost/app4/live -vf "hwupload,fps=30,scale_vaapi=640:-1:format=nv12" -c:v h264_vaapi -b:v 709k -acodec copy -f flv rtmp://localhost/app5/live; # ----------------------------------------------------------------------- } } # ------------------------------------------------------------------------ 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /tmp/hls; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; } location /dash { root /tmp/hls; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }