Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
pub:http-live-streaming [2013/12/06 19:12] – Externe Bearbeitung 127.0.0.1pub:http-live-streaming [2020/04/10 22:21] (aktuell) – Marco Krage
Zeile 1: Zeile 1:
-====== Http Live Streaming ====== +====== HTTP Live Streaming (HLS) mit nginx ======
-http://wiki.videolan.org/Documentation:Streaming_HowTo/Streaming_for_the_iPhone +
-https://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html+
  
-<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='#transcode{width=320,height=240,fps=25,vcodec=h264,vb=256,venc=x264{aud,profile=baseline,level=30,keyint=30,ref=1},acodec=mp3,ab=96}:std{access=livehttp{seglen=10,delsegs=true,numsegs=5,index=/var/www/streaming/mystream.m3u8,index-url=http://DOMAIN.TLD/streaming/mystream-########.ts},mux=ts{use-key-frames},dst=/var/www/streaming/mystream-########.ts}' +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/sergey-dryabzhinsky/nginx-rtmp-module.git 
 +   
 +Aktuellen Build von nginx laden und entpacken 
 +  wget http://nginx.org/download/nginx-1.16.1.tar.gz 
 +  tar -xf nginx-1.16.1.tar.gz 
 +  cd nginx-1.16.1 
 + 
 +nginx am besten in eigenes Verzeichnis kompilierern (über ''<nowiki>--prefix</nowiki>'') 
 +  ./configure --prefix=/usr/local/nginx-rtmp --with-http_ssl_module --add-module=../nginx-rtmp-module 
 +  make 
 +  make install 
 + 
 +Ordner erstellen in dem der Stream zur Auslieferung gespeichert wird.  
 + 
 +  mkdir -p /var/www/hls/live 
 +  mkdir -p /var/www/videos 
 +  mkdir -p /var/www/html 
 + 
 + 
 +===== nginx Konfiguration ===== 
 +<code> 
 +#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 /var/www/hls/live; 
 +      hls_nested on;  # create a new folder for each stream 
 +      record_notify on; 
 +      record_path /var/www/videos; 
 +      record all; 
 +      record_unique on; 
 +    } 
 + 
 +    application vod { 
 +      play /var/www/videos; 
 +    } 
 + } 
 +} 
 + 
 +# HTTP Konfiguration 
 +http { 
 +  include   mime.types; 
 +  default_type  application/octet-stream; 
 +  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/vnd.apple.mpegurl m3u8; 
 +      } 
 +      alias /var/www/hls/live; 
 +      add_header Cache-Control no-cache; 
 +    } 
 +  } 
 +}
 </code> </code>
  
-http://DOMAIN.TLD/stream/mystream.m3u8 
  
 +===== Web Player =====
 +''/var/www/html/player.html''
 +<code>
 +<!DOCTYPE html>
 +<html>
 +<head>
 +<meta charset=utf-8 />
 +<title>videojs-contrib-hls embed</title>
 +<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
 +</head>
 +<body>
 +  <h1>Video.js Example Embed</h1>
 +
 +  <video-js id="my_video_1" class="vjs-default-skin" controls preload="auto" width="640" height="480">
 +    <source src="http://localhost/live/STREAM-KEY/index.m3u8" type="application/x-mpegURL">
 +  </video-js>
 +
 +  <script src="https://unpkg.com/video.js/dist/video.js"></script>
 +  <script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
 +
 +  <script>
 +var player = videojs('my_video_1',{
 + liveui: true
 +});
 +  </script>
 +</body>
 +</html>
 +
 +</code>
 +
 +===== Streamen =====
 +STREAM-KEY ist ein freiwählbarer Name
 +
 +Stream Ziel ist: ''<nowiki>rtmp://server_ip:1935/live/STREAM-KEY</nowiki>''
 +
 +Die Playlist des Stream dann unter ''<nowiki>http://server_ip/live/STREAM-KEY/index.m3u8</nowiki>'' aufzurufen. Entweder über z.B. über VLC oder den Webplayer
 +
 +==== ffmpeg ====
 +
 +  ffmpeg -i /path/to/video  -c:v h264 -c:a aac  -strict -2 -f flv rtmp://server_ip:1935/live/STREAM-KEY
  
-<code bash>##Senden 
  
-nice vlc dshow:// :dshow-vdev="ZSMC USB PC Camera (ZS211)" \ +===== OBS Studio ===== 
-:dshow-adev="ESS Maestro" :dshow-size="320x240" \ +Stream-URL: ''<nowiki>rtmp://server_ip:1935/live</nowiki>'' 
---sout='#transcode{acodec=mp3,ab=16,vcodec=mp1v,vb=64}'\ +Stream-Key: frei wählbar z.B.: stream 
-':standard{mux=ts,access=udp,dst=tek:1234}'+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 '#standard{access=http,mux=ogg,dst=:8080}'</code> +https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/ 
-Quelle: http://www.wikihow.com/Stream-Your-Webcam+https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/ 
 +https://dev.to/samuyi/how-to-setup-nginx-for-hls-video-streaming-on-centos-7-3jb8
pub/http-live-streaming.1386353568.txt.gz · Zuletzt geändert: (Externe Bearbeitung)