Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| nginx-rtmp-module [2016/12/04 14:13] – [hls] meise | nginx-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\> 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\> |
| - | </ | + | |
| - | == compile | + | ## compile |
| - | < | + | \<code\> ./configure --add-module=../ |
| - | ./configure --add-module=../ | + | --with-http_stub_status_module |
| - | </ | + | |
| - | == rtmp | + | |
| - | / | + | ## rtmp |
| - | < | + | |
| - | user www-data; | + | |
| - | # multiple worker | + | / |
| - | worker_processes | + | |
| - | # important for multi worker processes!!1! | + | |
| - | rtmp_auto_push on; | + | |
| - | error_log | + | 1. |
| - | pid / | + | 2. |
| - | events { | + | error_log / |
| - | worker_connections | + | |
| - | } | + | |
| - | http { | + | events |
| - | server { | + | |
| - | listen [::]:80 default ipv6only=off; | + | |
| - | root / | + | http { server { listen \[::\]:80 default ipv6only=off; |
| - | index index.html index.htm; | + | |
| - | server_name localhost; | + | root / |
| - | # html page stuff | + | server_name localhost; |
| - | location / { | + | |
| - | try_files $uri $uri/ /index.html; | + | |
| - | } | + | |
| - | | + | 1. html page stuff location / { try_files \$uri \$uri/ /index.html; } |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | location /releases { alias / |
| - | | + | |
| - | auth_basic "Auf zum Atem!!1!"; | + | |
| - | auth_basic_user_file / | + | |
| - | | + | |
| - | | + | |
| - | # hls | + | location /releases/ |
| - | | + | "Auf zum Atem!!1!"; |
| - | types { | + | autoindex on; } |
| - | application/vnd.apple.mpegurl m3u8; | + | |
| - | video/mp2t ts; | + | |
| - | } | + | |
| - | alias /tmp/hls; | + | 1. hls location |
| - | | + | |
| - | | + | |
| - | # stats | + | alias /tmp/hls; autoindex on; } |
| - | location | + | |
| - | rtmp_stat all; | + | |
| - | allow 127.0.0.1; | + | |
| - | allow 195.54.164.160/ | + | |
| - | allow 188.40.235.220; | + | |
| - | deny all; | + | |
| - | | + | |
| - | | + | 1. stats location /stats/rtmp { rtmp_stat all; allow 127.0.0.1; allow |
| - | stub_status on; | + | |
| - | | + | meise deny all; } |
| - | | + | |
| - | allow 195.54.164.160/ | + | location / |
| - | | + | allow 195.54.164.160/ |
| - | deny all; | + | meise deny all; } } |
| - | | + | |
| - | | + | |
| } | } | ||
| - | rtmp { | + | rtmp { server { listen |
| - | | + | |
| - | | + | |
| - | | + | ping 30s; |
| - | # Disable audio until first video frame is sent. | + | 1. |
| - | | + | 2. |
| - | # | + | |
| - | | + | |
| - | # 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. |
| - | 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; |
| - | </ | + | |
| - | ffmpeg push: | + | allow play all; } } } \</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:// | + | |
| - | </ | + | |
| - | == hls | + | ffmpeg push: \< |
| + | yuv420p -profile:v baseline -preset fast -tune zerolatency -c:v libx264 | ||
| + | -strict -2 -c:a aac -f flv < | ||
| + | \</ | ||
| + | |||
| + | ## hls | ||
| / | / | ||
| 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 |
| - | < | + | 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:// | + | -strict -2 -c:a aac -f flv <rtmp:// |
| - | </ | + | \</code\> |
| - | + | ||
| - | + | ||
| - | * Das Verhaeltnis aus Segmentlaenge, | + | |
| + | - Das Verhaeltnis aus Segmentlaenge, | ||
| + | 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) | ||