Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user www-data;
- worker_processes 1;
- pid /run/nginx.pid;
- include /etc/nginx/modules-enabled/*.conf;
- events {
- worker_connections 768;
- # multi_accept on;
- }
- http {
- sendfile off;
- tcp_nopush on;
- tcp_nodelay on;
- keepalive_timeout 65;
- types_hash_max_size 2048;
- # server_tokens off;
- # server_names_hash_bucket_size 64;
- # server_name_in_redirect off;
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
- gzip on;
- # gzip_vary on;
- # gzip_proxied any;
- # gzip_comp_level 6;
- # gzip_buffers 16 8k;
- # gzip_http_version 1.1;
- # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
- include /etc/nginx/conf.d/*.conf;
- include /etc/nginx/sites-enabled/*;
- }
- rtmp {
- server {
- listen 1935;
- chunk_size 8192;
- application live {
- live on;
- interleave off;
- meta on;
- wait_key on;
- wait_video on;
- idle_streams off;
- sync 300ms;
- session_relay on;
- allow publish all;
- # deny publish all;
- # disable consuming the stream from nginx as rtmp #
- # deny play all;
- allow play all;
- #respawn on;
- #respawn_timeout 10s;
- # drop_idle_publisher 60s;
- ## == RECORDING OPTIONS: OFF/ALL == ##
- # default recorder #
- record off;
- record_suffix all-%d-%b-%y-%T.flv;
- record_path /var/www/recordings;
- record_max_size 4096M;
- record_unique on;
- record_append off;
- record_lock on;
- ## == FORWARD STREAM (OPTIONAL) == ##
- # == == TWITCH RE-STREAM == == #
- # push rtmp://live-ams.twitch.tv/app/LIVESTREAM_KEY;
- # == == YOUTUBE RE-STREAM == == #
- # push rtmp://a.rtmp.youtube.com/live2/LIVESTREAM_KEY;
- # == == MIXER.com RE-STREAM == == #
- # push rtmp://ingest-ams.mixer.com:1935/beam/LIVESTREAM_KEY;
- publish_notify off;
- # play_restart off;
- # on_publish http://your-website/on_publish.php;
- # on_play http://your-website/on_play.php;
- # on_record_done http://your-website/on_record_done.php;
- ## == HLS == ##
- hls on;
- hls_nested on;
- hls_path /var/www/hls/live;
- # hls_base_url http://abc.de:1953/hls;
- hls_playlist_length 60s;
- hls_fragment 10s;
- hls_sync 100ms;
- hls_cleanup on;
- ## == DASH == ##
- dash on;
- dash_nested on;
- dash_path /var/www/dash;
- dash_fragment 10s;
- dash_playlist_length 60s;
- dash_cleanup on;
- # == creates the downsampled or "trans-rated" mobile video stream as a 400kbps, re-sized video == #
- # exec ffmpeg -i rtmp://localhost/$app/$name -acodec copy -c:v libx264 -preset veryfast -profile:v baseline -vsync cfr -vf scale=-2:360,setdar=16:9 -b:v 400k -bufsize 400k -threads 0 -r 30 -f flv rtmp://localhost/low/${name};
- # https://selimatmaca.com/index.php/live-streaming/165-adaptive-bitrate-streaming-with-nginx-and-videojs #
- }
- # application liveout {
- # live on;
- # hls on;
- # hls_path /var/www/hls/liveout;
- # hls_fragment 10s;
- # hls_playlist_length 60s;
- # allow play all;
- # allow publish 127.0.0.1;
- # allow publish 192.168.2.88;
- # allow publish 192.168.2.0/24;
- # deny publish all;
- # # hls_variant _240 BANDWIDTH=288000;
- # hls_variant _360 BANDWIDTH=448000;
- # hls_variant _480 BANDWIDTH=1152000;
- # hls_variant _720 BANDWIDTH=2048000;
- # # hls_variant _1080 BANDWIDTH=4096000;
- # }
- application hls {
- live on;
- allow play all;
- hls on;
- hls_path /var/www/hls;
- hls_fragment 10s;
- hls_playlist_length 60s;
- }
- # Creates "mobile" lower-res HLS videostream from ffmpeg-created stream and where to put the manifest and video fragments #
- application low {
- live on;
- allow play all;
- hls on;
- hls_nested on;
- hls_path /var/www/hls/low;
- hls_fragment 10s;
- hls_playlist_length 60s;
- }
- # application ipcam {
- # live on;
- # exec_pull ffmpeg -i rtsp://192.168.4.250:554/h264.sdp -c copy -f flv rtmp://localhost/ipcam/h264;
- # exec_pull ffmpeg -i rtsp://192.168.4.250:554/mjpeg.sdp -c copy -f flv rtmp://localhost/ipcam/mjpeg;
- # }
- # Allows playing earlier recorded files #
- application vod {
- play /var/www/recordings;
- allow play all;
- }
- application vod_http {
- play http://yourserver.ddns.net/recordings;
- allow play all;
- }
- # application vod_mirror {
- # # try local location first, then access remote location
- # play /var/www/recordings http://yourserver.ddns.net/vods;
- # }
- }
- }
Add Comment
Please, Sign In to add comment