Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| pub:http-live-streaming [2013/12/06 19:12] – Externe Bearbeitung 127.0.0.1 | pub:http-live-streaming [2020/04/10 22:21] (aktuell) – Marco Krage | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== | + | ====== |
| - | http:// | + | |
| - | https:// | + | |
| - | <code bash> | + | Wir bauen hier einen speziellen nginx, mit einem rtmp Modul, welcher einen rtmp Stream empangen kann und daraus eine HLS Playlist und die Videos Chunks in einem Web Root ablegt. |
| - | vlc -I dummy /data/test.m2ts vlc://quit --sout='# | + | Optional stellt er dieses auch direkt als Webserver bereit. Das Verzeichnis könnte aber von einem bestehenden Webservers ausgeliefert werden. |
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | apt install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g zlib1g-dev | ||
| + | |||
| + | RTMP Modul clonen | ||
| + | git clone https://github.com/ | ||
| + | |||
| + | Aktuellen Build von nginx laden und entpacken | ||
| + | wget http://nginx.org/ | ||
| + | tar -xf nginx-1.16.1.tar.gz | ||
| + | cd nginx-1.16.1 | ||
| + | |||
| + | nginx am besten in eigenes Verzeichnis kompilierern (über | ||
| + | ./configure --prefix=/ | ||
| + | make | ||
| + | make install | ||
| + | |||
| + | Ordner erstellen in dem der Stream zur Auslieferung gespeichert wird. | ||
| + | |||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | |||
| + | |||
| + | ===== nginx Konfiguration | ||
| + | < | ||
| + | #user nginx; | ||
| + | worker_processes auto; | ||
| + | events { | ||
| + | worker_connections 1024; | ||
| + | } | ||
| + | |||
| + | # RTMP Konfiguration | ||
| + | rtmp { | ||
| + | server | ||
| + | listen 1935; | ||
| + | chunk_size 4096; | ||
| + | ping 30s; | ||
| + | notify_method get; | ||
| + | allow play all; | ||
| + | # rmtp handler our clients connect to for live streaming, it runs on port 1935. It converts the stream to HLS and stores it on our server | ||
| + | application live { | ||
| + | live on; | ||
| + | hls on; | ||
| + | hls_path | ||
| + | hls_nested on; # create a new folder for each stream | ||
| + | record_notify on; | ||
| + | record_path / | ||
| + | record all; | ||
| + | record_unique on; | ||
| + | } | ||
| + | |||
| + | application vod { | ||
| + | play / | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # HTTP Konfiguration | ||
| + | http { | ||
| + | include | ||
| + | default_type | ||
| + | sendfile on; | ||
| + | tcp_nopush on; | ||
| + | keepalive_timeout 65; | ||
| + | gzip on; | ||
| + | server { | ||
| + | listen 80; | ||
| + | server_name _; | ||
| + | |||
| + | autoindex on; | ||
| + | |||
| + | location | ||
| + | root /var/www/html; | ||
| + | index index.html index.htm; | ||
| + | | ||
| + | # the http end point our web based users connect to see the live stream | ||
| + | location /live { | ||
| + | types { | ||
| + | application/ | ||
| + | | ||
| + | alias /var/www/hls/live; | ||
| + | add_header Cache-Control no-cache; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| - | http:// | ||
| + | ===== Web Player ===== | ||
| + | ''/ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <meta charset=utf-8 /> | ||
| + | < | ||
| + | <link href=" | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | <source src=" | ||
| + | </ | ||
| + | |||
| + | <script src=" | ||
| + | <script src=" | ||
| + | |||
| + | < | ||
| + | var player = videojs(' | ||
| + | liveui: true | ||
| + | }); | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Streamen ===== | ||
| + | STREAM-KEY ist ein freiwählbarer Name | ||
| + | |||
| + | Stream Ziel ist: ''< | ||
| + | |||
| + | Die Playlist des Stream dann unter ''< | ||
| + | |||
| + | ==== ffmpeg ==== | ||
| + | |||
| + | ffmpeg -i / | ||
| - | <code bash>## | ||
| - | nice vlc dshow:// :dshow-vdev="ZSMC USB PC Camera (ZS211)" | + | ===== OBS Studio ===== |
| - | :dshow-adev="ESS Maestro" | + | Stream-URL: |
| - | --sout='# | + | Stream-Key: frei wählbar z.B.: stream |
| - | ':standard{mux=ts, | + | Nach dem Stream Key richtet sich auch die playlist und clip Namen welche dann über den Webserver aufrufbar sind. |
| - | ##empfangen | ||
| - | #!/bin/bash | + | Quellen: |
| - | vlc -vvv udp: --sout '# | + | https://docs.peer5.com/ |
| - | Quelle: http://www.wikihow.com/Stream-Your-Webcam | + | https://obsproject.com/forum/ |
| + | https:// | ||