Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| nginx-rtmp-module [2013/11/05 11:49] – [compile] meise | nginx-rtmp-module [2016/12/04 15:13] (current) – [hls] meise | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | = nginx-rtmp-module | ||
| + | |||
| + | == debian pakete | ||
| + | |||
| + | < | ||
| + | apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev libbz2-dev libssl-dev tar unzip | ||
| + | </ | ||
| + | |||
| + | == compile | ||
| + | |||
| + | < | ||
| + | ./configure --add-module=../ | ||
| + | </ | ||
| + | == rtmp | ||
| + | |||
| + | / | ||
| + | < | ||
| + | user www-data; | ||
| + | |||
| + | # multiple worker | ||
| + | worker_processes | ||
| + | # important for multi worker processes!!1! | ||
| + | rtmp_auto_push on; | ||
| + | |||
| + | error_log | ||
| + | pid / | ||
| + | |||
| + | events { | ||
| + | worker_connections | ||
| + | } | ||
| + | |||
| + | http { | ||
| + | server { | ||
| + | listen [::]:80 default ipv6only=off; | ||
| + | |||
| + | root / | ||
| + | index index.html index.htm; | ||
| + | |||
| + | server_name localhost; | ||
| + | |||
| + | # html page stuff | ||
| + | location / { | ||
| + | try_files $uri $uri/ / | ||
| + | } | ||
| + | |||
| + | location /releases { | ||
| + | alias / | ||
| + | | ||
| + | } | ||
| + | |||
| + | location / | ||
| + | alias / | ||
| + | auth_basic "Auf zum Atem!!1!"; | ||
| + | auth_basic_user_file / | ||
| + | autoindex on; | ||
| + | } | ||
| + | |||
| + | # hls | ||
| + | location /hls { | ||
| + | types { | ||
| + | application/ | ||
| + | video/mp2t ts; | ||
| + | } | ||
| + | |||
| + | alias /tmp/hls; | ||
| + | autoindex on; | ||
| + | } | ||
| + | |||
| + | # stats | ||
| + | location /stats/rtmp { | ||
| + | rtmp_stat all; | ||
| + | allow 127.0.0.1; | ||
| + | allow 195.54.164.160/ | ||
| + | allow 188.40.235.220; | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location / | ||
| + | stub_status on; | ||
| + | access_log | ||
| + | allow 127.0.0.1; | ||
| + | allow 195.54.164.160/ | ||
| + | allow 188.40.235.220; | ||
| + | deny all; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | rtmp { | ||
| + | server { | ||
| + | listen [::]:1935 ipv6only=off; | ||
| + | |||
| + | ping 30s; | ||
| + | |||
| + | # Disable audio until first video frame is sent. | ||
| + | wait_video on; | ||
| + | # Send NetStream.Publish.Start and NetStream.Publish.Stop to subscribers. | ||
| + | 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 { | ||
| + | # enable live streaming | ||
| + | live on; | ||
| + | meta copy; | ||
| + | |||
| + | hls on; | ||
| + | hls_path /tmp/hls; | ||
| + | hls_fragment 5; | ||
| + | |||
| + | # publish only from localhost | ||
| + | allow publish 127.0.0.1; | ||
| + | deny publish all; | ||
| + | |||
| + | allow play all; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ffmpeg push: | ||
| + | < | ||
| + | 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 | ||
| + | |||
| + | / | ||
| + | |||
| + | → siehe Abschnitt hls und http in der rtmp Konfiguration. | ||
| + | |||
| + | ffmpeg push: | ||
| + | < | ||
| + | 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:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | * Das Verhaeltnis aus Segmentlaenge, | ||
| + | |||