29
Video-Livestreaming bei den Chemnitzer Linux-Tagen

Video-Livestreaming bei den Chemnitzer Linux-Tagen · Standards und Protokolle beim Streaming RTMP (Real Time Messaging Protocol, Macromedia/Adobe) HLS (HTTP Live Streaming, Apple)

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Video-Livestreaming bei den Chemnitzer Linux-Tagen

Agenda

1. Grundlagen

2. Hardware & Software

3. Aufbau vor 2017◈ viel VLC◈ Scripte◈ Hintergründe

4. Aufbau ab 2017/18

5. Live-Demo

6. Ausblick

Grundlagen

Standards und Protokolle beim Streaming

◈ RTMP (Real Time Messaging Protocol, Macromedia/Adobe)

◈ HLS (HTTP Live Streaming, Apple)

◈ MPEG-DASH (Dynamic Adaptive Streaming over HTTP, DASH Industry Forum)

Außerdem◈ RTP-Streaming◈ UDP-Streaming◈ HDS (HTTP Adaptive Streaming, Adobe)

Für später vormerken◈ [MPEG] CMAF (Common Media Application Format, Microsoft & Apple)

Hardware & Software

Zutaten

8x Desktop + 2x ASUS Pro Laptops @CLT 2015

epiphan VGA2USB ©Amazon

Magewell Capture HDMI Plus ©Magewell

Aufbau vor 2017

Verkabelung

Präsentation

Beamer

SchnittEncoding

Upload

NOC

VGA-CapturingEncodingRecording

Vortragsräume

Streaming-Server

HLS(MPEG-DASH)

Im Detail

Audio-Stream

Video-Stream

Capturing-PC

MPEG2-TS

MKV

Streaming Server

Audio-Stream

HD

MI-

Sign

al

Capturing Foyer-Kamera

MPEG2-TS

Capturing

Filtering

Packaging

Vortragsraum

Pausenstream

Encoding-PC

Backup-Standbild

VLC-Switch

Signal-Bereinigung

Finales Encoding

MPEG2-TS

MPEG2-TS

MPEG2-TS

RTMP

Capturing mit VLC

1 REM Definition von Variablen. 2 REM SAVESTAMP zur Beschreibung von Log-Dateien 3 REM AUDIOSRC ist die jeweilige Audio-Quelle von Radio UNiCC 4 5 set SAVESTAMP=%DATE:.=-%@%TIME::=-% 6 set SAVESTAMP=V%1-%SAVESTAMP: =% 7 set AUDIOSRCCODEC=mp3 8 9 if "%1" == "1" (10 set VGANR=V2U11398911 set AUDIOSRC=http://dobro.hrz.tu-chemnitz.de:8000/live128.mp3 ... 34 if "%1" == "7" (35 set VGANR=V2U11894336 set AUDIOSRC=http://mazhar.hrz.tu-chemnitz.de:8000/live128.mp337 )

Capturing mit VLC

38 :loop39 start "VLC SRC %1" /WAIT C:\Programme\VideoLAN\VLC\vlc.exe ^40 dshow:// ^41 --dshow-vdev="VGA2USB %VGANR%" ^42 --dshow-adev="none" ^43 --dshow-aspect-ratio=16:10 ^44 --dshow-chroma=YUY2 ^45 --no-dshow-config ^46 --no-dshow-tuner ^47 -I dummy ^48 -vv ^49 --swscale-mode=10 ^50 --sout-keep ^51 --live-caching=1000 ^52 --network-caching=1000 ^53 --sout-mux-caching=1000 ^54 --sout="#transcode{vcodec=mp2v,vb=3000,width=1280,height=800}: duplicate{dst="standard{access=http,mux=ts,dst=0.0.0.0:8080 /V%1.ts}",dst="standard{access=file,mux=ts, dst='%SAVESTAMP%_single_v.ts'}"}" ^

Capturing mit VLC

55 | c:\Programme\ffmpeg\bin\ffmpeg.exe ^56 -loglevel info ^57 -f mpegts ^58 -i http://127.0.0.1:8080/V%1.ts ^59 -f %AUDIOSRCCODEC% ^60 -i %AUDIOSRC% ^61 -codec:v copy ^62 -codec:a copy ^63 -f matroska %SAVESTAMP%_mux.mkv64 goto loop

und Recording mit ffmpeg

Im Detail

Audio-Stream

Video-Stream

Capturing-PC

MPEG2-TS

MKV

Streaming Server

Audio-Stream

HD

MI-

Sign

al

Capturing Foyer-Kamera

MPEG2-TS

Capturing

Filtering

Packaging

Vortragsraum

Pausenstream

Encoding-PC

Backup-Standbild

VLC-Switch

Signal-Bereinigung

Finales Encoding

MPEG2-TS

MPEG2-TS

MPEG2-TS

RTMP

Foyer-Kamera 1 :loop 2 echo %date%_%time% ... Started Camera Capturing >>cltlog.txt 3 c:\Programme\ffmpeg\bin\ffmpeg.exe ^ 4 -f dshow ^ 5 -show_video_device_dialog true ^ 6 -rtbufsize 1002000k ^ 7 -r 25 ^ 8 -i video="Blackmagic WDM Capture":audio="Eingang (Blackmagic Audio)" ^ 9 -threads 4 ^10 -s 1280x720 ^11 -pix_fmt yuv420p ^12 -vcodec libx264 13 -b:v 5000k 14 -g 50 ^15 -preset ultrafast ^16 -deinterlace ^17 -vsync drop ^18 -codec:a aac ^19 -ac 2 ^22 -ar 44100 ^23 -b:a 128k ^24 -f mpegts udp://127.0.0.1:6666

Foyer-Kamera 3 c:\Programme\ffmpeg\bin\ffmpeg.exe ^ 4 -re ^ 5 -i udp://127.0.0.1:6666 -i linuxtage.png ^ 6 -filter_complex "[0:v]setpts=PTS-STARTPTS,overlay=( main_w-overlay_w)/2:(main_h-overlay_h)/2, split[out1][out2]" ^ 7 -map [out1] ^ 8 -vcodec libx264 ^ 9 -b:v 2500k ^10 -g 50 ^11 -preset ultrafast ^12 -vsync drop ^13 -codec:a copy ^14 -f mpegts udp://127.0.0.1:6667 ^

15 -map [out2] ^16 -vcodec libx264 ^17 -b:v 2500k ^18 -g 50 ^19 -preset ultrafast ^20 -vsync drop ^21 -codec:a aac ^22 -ac 2 ^23 -ar 44100 ^24 -b:a 96k ^25 -async 1 ^26 -f flv rtmp://clt2015.server.net/

clt2015?doPublish=user/foyer.stream

Foyer-Kamera 1 set PORT=8089 2 :loop 3 echo %date%_%time% ... Started VLC Foyer Transmission >>cltlog.txt 4 start "VLC Transmission" /D c:\Users\admin\Videos\pause /WAIT C:\Programme\VideoLAN\VLC\vlc.exe ^ 5 udp://@127.0.0.1:6667 ^ 6 --width=1280 ^ 7 --height=800 ^ 8 --aspect-ratio=16:10 ^ 9 --swscale-mode=5 ^10 -vvv ^11 -I dummy ^12 --network-caching=1000 ^13 --sout-mux-caching=2000 ^14 --sout-keep ^15 --sout="#transcode{vcodec=mp2v,vb=3500,width=1280,height=800, acodec=mp3,ab=128}:standard{access=http,mux=ts{pid- video=101,pid-audio=102,pid-pmt=1},dst=0.0.0.0: %PORT%/pause.ts}"16 17 goto loop

Im Detail

Audio-Stream

Video-Stream

Capturing-PC

MPEG2-TS

MKV

Streaming Server

Audio-Stream

HD

MI-

Sign

al

Capturing Foyer-Kamera

MPEG2-TS

Capturing

Filtering

Packaging

Vortragsraum

Pausenstream

Encoding-PC

Backup-Standbild

VLC-Switch

Signal-Bereinigung

Finales Encoding

MPEG2-TS

MPEG2-TS

MPEG2-TS

RTMP

VLC als Bildmischer

◈ zwischen 3 Bildquellen schalten◈ Vortragsraum◈ Standbild (hauptsächlich als Backup)◈ Foyer-Kamera

◈ Steuerung über Webinterface◈ Output als RTMP-Stream zum Streaming-Server

Dafür brauchen wir◈ viel VLC◈ VLC-Playlist◈ ein bisschen FFMPEG

VLC als Bildmischer 1 set VIDEO=http://141.55.209.169:8080/V%1.ts.. 7 set STILL=http://141.55.209.168:8089/still.ts 8 set PAUSE=http://127.0.0.1:8080/pause.ts

11 start "VLC %1" /D c:\Users\admin\Videos /MIN /WAIT c: \Programme\VideoLAN\VLC\vlc.exe ^12 -vvv ^13 -I dummy ^14 --extraintf=http ^15 --http-host 0.0.0.0 ^16 --http-port 807%1 ^17 --http-password secure ^18 --swscale-mode=10 ^19 --repeat %VIDEO% %STILL% %PAUSE% ^20 --live-caching=1000 ^21 --network-caching=1000 ^22 --sout-mux-caching=2000 ^23 --sout-keep ^24 --sout="#transcode{vcodec=mp2v,vb=3000,width=1280,height=800, fps=25}:standard{access=http,mux=ts{pid-video=101,pid- audio=102,pid-pmt=1},dst=0.0.0.0:809%1/V%1.ts}"

2018Willkommen in der Neuzeit

HDMI & Open Broadcaster Studio

Präsentation

Beamer

VGA-CapturingEncodingRecording

SchnittEncoding

Upload

NOCVortragsräume

Streaming-Server

HLSMPEG-DASH

Im Detail

Audio-Signal

HD

MI-Signal

Capturing-PC

MP4

Streaming Server

Vortragsraum

Virtual Machine

RTMPMagewell

OBS

RTMP

Open Broadcaster Software

Nginx-Konfiguration

◈ VM mit Ubuntu◈ Nginx selbst kompiliert

◈ mit rtmp-module◈ https://github.com/arut/nginx-rtmp-module/

rtmp-module◈ rtmp-support◈ HLS-Packaging◈ MPEG-DASH Packaging

◈ besser: https://github.com/ut0mt8/nginx-rtmp-module◈ Recording◈ Ausführung von Executables (ffmpeg)◈ Command-Interface

nginx RTMP-Konfiguration 1 rtmp { 2 server { 3 listen 1935; 4 5 application v1 { 6 live on; 7 exec_push ffmpeg -i rtmp://localhost/$app/$name -c copy

-f rtmp://user:[email protected]:1935/linuxtage/$name; 8 record all; 9 10 recorder rec {11 record_interval 60m;12 record_lock on;13 record_suffix -%Y-%m-%d_%H-%M-%S.ts;14 record_path /home/user/clt2018_records;1516 } 17 }18 }19 }

rtmp://hostname/app/name

Website-Player

◈ Primär MPEG-DASH mit DASH.js◈ http://reference.dashif.org/dash.js/v2.6.6/samples/dash-if-reference-player/index.html◈ weitgehend alle Plattformen außer Apple◈ Untertitel-Support auf allen Plattformen

◈ Sekundär HLS mit HLS.js◈ weitestgehend auf allen Plattformen unterstützt◈ hauptsächlich aber für Apple-Endgeräte

Live-Demo

Ausblick

◈ Raspberry Pis als Kamera vor dem Referent

◈ Übertragung Inhouse mit NewTek NDIPlugins für:◈ OBS◈ ffmpeg◈ VLC

◈ Schnitt auf VM

Vielen Dank!