user www-data; worker_processes 1; #si esto != 1 se rompe todo el curso en vivo #https://github.com/arut/nginx-rtmp-module/wiki/Directives#multi-worker-live-streaming #rtmp_auto_push on; #rtmp_auto_push_reconnect 1s; #rtmp_socket_dir /var/sock; pid /var/run/nginx.pid; events { worker_connections 1024; # multi_accept on; } rtmp { server { listen 1935; ping_timeout 30s; max_streams 64; chunk_size 4096; ack_window 2000000; interleave on; #defaults to off buflen 1s; sync 100ms; wait_video on; wait_key on; drop_idle_publisher 10s; #play_restart off; #seguro? play_restart on; #seguro? publish_notify on; publish_time_fix off; play_time_fix off; live on; application src { recorder rec0 { record all; record_path /var/videos/; record_unique on; } exec_push /usr/bin/pull_rtmp.sh; # exec_push /usr/bin/ffmpeg -i rtmp://localhost/src/$name # -c copy -f flv rtmp://localhost/hls/$name; # -c copy -f flv rtmp://localhost/hls/$name_high; # -c:v libx264 -s 360x270 -c:a copy -preset veryfast -r 10 -g 20 -f flv rtmp://localhost/hls/$name_low; } # application hls { # hls on; # hls_fragment_slicing plain; # hls_path /tmp/hls; # hls_fragment 15s; # hls_playlist_length 30s; # hls_type live; # } # hls_fragment_slicing aligned; # hls_nested on; # hls_variant _low BANDWIDTH=240000; # hls_variant _high BANDWIDTH=1000000; } } http { ## # Basic Settings ## #sendfile on; #tcp_nopush on; #tcp_nodelay on; #keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 100m; server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/ssl; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_min_length 100; gzip_proxied expired no-cache no-store private auth; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }