nginx-rtmp-module

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
nginx-rtmp-module [2016/12/04 14:13] – [hls] meisenginx-rtmp-module [2026/07/26 21:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
-nginx-rtmp-module+nginx-rtmp-module
  
-== debian pakete+## debian pakete
  
-<code> +\<code\> apt-get install build-essential zlib1g-dev libpcre3 
-apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev libbz2-dev libssl-dev tar unzip  +libpcre3-dev libbz2-dev libssl-dev tar unzip \</code\>
-</code>+
  
-== compile+## compile
  
-<code> +\<code\> ./configure --add-module=../nginx-rtmp-module --with-ipv6 
-./configure --add-module=../nginx-rtmp-module --with-ipv6 --with-http_stub_status_module  +--with-http_stub_status_module \</code\>
-</code> +
-== rtmp+
  
-/usr/local/nginx/conf/nginx.conf: +## rtmp
-<code> +
-user  www-data;+
  
-# multiple worker +/usr/local/nginx/conf/nginx.conf: \<code\> user www-data;
-worker_processes  2; +
-# important for multi worker processes!!1! +
-rtmp_auto_push on;+
  
-error_log  /var/log/nginx/error.log+1 multiple worker worker_processes 2
-pid /var/run/nginx.pid;+2 important for multi worker processes!!1! rtmp_auto_push on;
  
-events { +error_log /var/log/nginx/error.log; pid /var/run/nginx.pid;
-    worker_connections  2048; +
-}+
  
-http { +events worker_connections 2048}
-    server { +
-        listen [::]:80 default ipv6only=off;+
  
-        root /srv/nginx/htdocs; +http { server { listen \[::\]:80 default ipv6only=off;
-        index index.html index.htm;+
  
-        server_name localhost;+root /srv/nginx/htdocs; index index.html index.htm;
  
-        # html page stuff +server_name localhost;
-        location / { +
-                try_files $uri $uri/ /index.html; +
-        }+
  
-        location /releases { +1.  html page stuff location / { try_files \$uri \$uri/ /index.html; }
-               alias /srv/releases; +
-               autoindex on; +
-        }+
  
-        location /releases/private { +location /releases { alias /srv/releases; autoindex on; }
-                alias /srv/releases/private; +
-                auth_basic "Auf zum Atem!!1!"; +
-                auth_basic_user_file /etc/nginx/releases_htpasswd; +
-                autoindex on; +
-        }+
  
-        # hls +location /releases/private alias /srv/releases/privateauth_basic 
-        location /hls { +"Auf zum Atem!!1!"; auth_basic_user_file /etc/nginx/releases_htpasswd
-            types { +autoindex on; }
-                application/vnd.apple.mpegurl m3u8+
-                video/mp2t ts+
-            }+
  
-            alias /tmp/hls; +1.  hls location /hls { types { application/vnd.apple.mpegurl m3u8
-            autoindex on; +    video/mp2t ts; }
-        }+
  
-        # stats +alias /tmp/hlsautoindex on; }
-        location /stats/rtmp { +
-            rtmp_stat all; +
-            allow 127.0.0.1; +
-            allow 195.54.164.160/29; # berlin +
-            allow 188.40.235.220;    # oglarun → meise +
-            deny all; +
-        }+
  
-        location /stats/nginx +1.  stats location /stats/rtmp rtmp_stat all; allow 127.0.0.1; allow 
-            stub_status on; +    195.54.164.160/29; \# berlin allow 188.40.235.220; \# oglarun → 
-            access_log   off; +    meise deny all; } 
-            allow 127.0.0.1; + 
-            allow 195.54.164.160/29; # berlin +location /stats/nginx { stub_status on; access_log off; allow 127.0.0.1; 
-            allow 188.40.235.220;    # oglarun → meise +allow 195.54.164.160/29; \# berlin allow 188.40.235.220; \# oglarun → 
-            deny all; +meise deny all; } }
-        } +
-    }+
  
 } }
  
-rtmp { +rtmp { server { listen \[::\]:1935 ipv6only=off;
-    server { +
-        listen [::]:1935 ipv6only=off;+
  
-        ping 30s;+ping 30s;
  
-        # Disable audio until first video frame is sent. +1.  Disable audio until first video frame is sent. wait_video on; 
-        wait_video on; +2.  Send NetStream.Publish.Start and NetStream.Publish.Stop to 
-        # Send NetStream.Publish.Start and NetStream.Publish.Stop to subscribers. +    subscribers. publish_notify on;
-        publish_notify on;+
  
-        # Synchronize audio and video streams. If subscriber bandwidth is not +<!-- -->
-        # enough to receive data at ublisher rate some frames are dropped by +
-        # server. This leads to synchronization problem. When timestamp +
-        # difference exceeds the value specified as sync argument an absolute +
-        # frame is sent fixing that. Default is 300ms. +
-        sync 10ms;+
  
-        application stream { +1.  Synchronize audio and video streams. If subscriber bandwidth is not 
-            # enable live streaming +2.  enough to receive data at ublisher rate some frames are dropped by 
-            live on; +3.  server. This leads to synchronization problem. When timestamp 
-            meta copy;+4.  difference exceeds the value specified as sync argument an absolute 
 +5.  frame is sent fixing that. Default is 300ms. sync 10ms;
  
-            hls on; +application stream {
-            hls_path /tmp/hls; +
-            hls_fragment 5;+
  
-            # publish only from localhost +1 enable live streaming live onmeta copy;
-            allow publish 127.0.0.1; +
-            deny publish all;+
  
-            allow play all+hls on; hls_path /tmp/hls; hls_fragment 5
-        } + 
-    } +1.  publish only from localhost allow publish 127.0.0.1; deny publish 
-+    all;
-</code>+
  
-ffmpeg push: +allow play all; } } } \</code\>
-<code> +
-ffmpeg -re -i catcontent.ogg -threads 0 -pix_fmt yuv420p -profile:v baseline -preset fast -tune zerolatency -c:v libx264 -strict -2 -c:a aac -f flv rtmp://localhost:1935/stream/katze +
-</code>+
  
-== hls+ffmpeg push: \<code\> ffmpeg -re -i catcontent.ogg -threads 0 -pix_fmt 
 +yuv420p -profile:v baseline -preset fast -tune zerolatency -c:v libx264 
 +-strict -2 -c:a aac -f flv <rtmp://localhost:1935/stream/katze> 
 +\</code\> 
 + 
 +## hls
  
 /usr/local/nginx/conf/nginx.conf: /usr/local/nginx/conf/nginx.conf:
Line 136: Line 89:
 → siehe Abschnitt hls und http in der rtmp Konfiguration. → siehe Abschnitt hls und http in der rtmp Konfiguration.
  
-ffmpeg push: +ffmpeg push: \<code\> ffmpeg -re -i catcontent.ogg -threads 0 -pix_fmt 
-<code> +yuv420p -profile:v baseline -preset fast -tune zerolatency -c:v libx264 
-ffmpeg -re -i catcontent.ogg -threads 0 -pix_fmt yuv420p -profile:v baseline -preset fast -tune zerolatency -c:v libx264 -strict -2 -c:a aac -f flv rtmp://localhost:1935/stream/katze +-strict -2 -c:a aac -f flv <rtmp://localhost:1935/stream/katze> 
-</code> +\</code\>
- +
- +
- * Das Verhaeltnis aus Segmentlaenge, m3u8 cache duration und Kaskadentiefe war falsch. Die cache-duration muss < segment-laenge / 2 sein, bei 2 Cache-Stufen (wie bei uns) / 8. Fixed durch Setzen der Segmentlaenge auf 10s. (Unsere m3u8 cache-duration war und ist 1s)+
  
 +- Das Verhaeltnis aus Segmentlaenge, m3u8 cache duration und
 +  Kaskadentiefe war falsch. Die cache-duration muss \< segment-laenge /
 +  2 sein, bei 2 Cache-Stufen (wie bei uns) / 8. Fixed durch Setzen der
 +  Segmentlaenge auf 10s. (Unsere m3u8 cache-duration war und ist 1s)
  
  • nginx-rtmp-module.1480860801.txt.gz
  • Last modified: 2016/12/04 14:13
  • by meise