Benutzer-Werkzeuge

Webseiten-Werkzeuge


videostreaming

Videostreaming

Allg. Hinweis: Es gibt ffmpeg und libav. Letzteres ist in Debian Jessie enthalten, wird aber in der folgenden Version wieder durch ffmpeg ersetzt. Des weiteren scheint libav ggf. Probleme zu bereiten. Deshalb auf Rechnern, die für Streaming verwendet werden sollen auf jeden Fall ffmpeg verwenden.

Server

NGINX

Anleitungen

git clone https://github.com/arut/nginx-rtmp-module.git
cd nginx-rtmp-module
git checkout v1.1.10
cd ..

wget http://nginx.org/download/nginx-1.11.9.tar.gz
tar xzf nginx-1.11.9.tar.gz
cd nginx-1.11.9
./configure --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx-rtmp-module
make -j2
make install

nginx -h
nginx -v


mkdir /var/log/nginx
chown www-data.adm /var/log/nginx
chmod 770 /var/log/nginx

Konfiguration RTMP simple

Konfiguration HTTP Live Streaming (HLS)

Achtung: Noch nicht fertiggestellt!

Vorarbeiten

cd /var/www
mkdir HLS
mkdir HLS/live
mkdir HLS/mobile
mkdir video_recordings
chmod -R 775 video_recordings
nginx.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;
 
events {
    worker_connections  1024;
}
 
http {
 
    ##
    # Basic Settings
    ##
 
    include mime.types;
    default_type application/octet-stream;
 
    ##
    # SSL Settings
    ##
 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;
 
    ##
    # Logging Settings
    ##
 
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
 
    ##
    # Virtual Host Configs
    ##
 
    server {
        listen 80;
        server_name xxx;
 
        # creates the http-location for our full-resolution (desktop) HLS stream 
        # http://my-ip/live/my-stream-key/index.m3u8
        location /live {
            types {
                application/vnd.apple.mpegurl m3u8;
            }
            alias /HLS/live;
            add_header Cache-Control no-cache;
        }
 
 
    }
}
 
# RTMP Server
rtmp {
    server {
        listen 1935;
        allow play all;
 
        application live {
            allow play all;
            live on;
            record all;
            record_path /video_recordings;
            record_unique on;
            hls on;
            hls_nested on;
            hls_path /HLS/live;
            hls_fragment 10s;
        }
 
        application vod {
            play /video_recordings;
        }
 
    }
}

Client: OBS-Studio

Siehe auch: Bedienhinweise

IRC auf Freenode: #obsproject

Aktuelles Videosystem:

  • Medion MS-7646
  • 4 GB RAM
  • AMD 3 Cores
  • 1 TB HDD

Fix für fehlerhaftes TSScorp-Laufwerk UDEV-Regel auskommentieren

# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode"
$ sudo sed -i '/ATAPI/,+1s/^/#/' /lib/udev/rules.d/60-persistent-storage.rules
$ sudo update-initramfs -u
$ sudo reboot now

Build Environment

apt-get install build-essential pkg-config cmake git checkinstall

Benötigte Pakete

apt-get install libx11-dev libgl1-mesa-dev libpulse-dev libxcomposite-dev \
        libxinerama-dev libv4l-dev libudev-dev libfreetype6-dev \
        libfontconfig-dev qtbase5-dev libqt5x11extras5-dev libqt5svg5-dev libx264-dev \
        libxcb-xinerama0-dev libxcb-shm0-dev libjack-jackd2-dev libcurl4-openssl-dev

Debian 9 Stretch (WIP)

apt-get install libavutil-dev libavfilter-dev libavdevice-dev libspeexdsp-dev

FFMpeg erstellen

apt-get install zlib1g-dev yasm
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout <version>
./configure --enable-shared
make -j4
checkinstall --pkgname=FFmpeg --fstrans=no --backup=no \
    --pkgversion="$(date +%Y%m%d)-git" --deldoc=yes
ldconfig

OBS-Studio erstellen

cd /usr/local/src
git clone https://github.com/jp9000/obs-studio.git
cd obs-studio
git checkout <version>
mkdir build && cd build
cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
checkinstall --pkgname=obs-studio --fstrans=no --backup=no \
    --pkgversion="$(date +%Y%m%d)-git" --deldoc=yes
$ lspci
05:00.0 Multimedia video controller: Blackmagic Design DeckLink Mini Recorder
	Subsystem: Blackmagic Design DeckLink Mini Recorder
	Flags: bus master, fast devsel, latency 0, IRQ 7
	Memory at fdc00000 (32-bit, non-prefetchable) [size=1M]
	Capabilities: [40] Power Management version 3
	Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [58] Express Endpoint, MSI 00
  • Download: Blackmagic_Desktop_Video_Linux_11.6.tar.gz
  • Auspacken
    • Es entsteht ein Unterverzeichnis mit x64-deb-Paketen
  • Installieren
    dpkg -i desktopvideo_11.6.6a26_amd64.deb
  • Neustarten
  • Installieren
    dpkg -i desktopvideo-gui_11.6.6a26_amd64.deb

Web Portal

Nach einigen Versuchen ist es mir gelungen, mit Video.js einen Stream im Browser darzustellen. Für RTMP wird allerdings von zencdn nachgeladen, da flashbasierend. Das ist natürlich keine schöne Situation, allerdings in Sinne der grundsätzlichen Funktionsfähigkeit erst einmal akzeptabel.

Live555 Proxy-Server

wget http://live555.com/liveMedia/public/live.2019.11.11.tar.gz
tar xzf live.2019.11.11.tar.gz
cd live
./genMakefiles linux-64bit
make

Das Ergebnis liegt im Verzeichnis „proxyServer“:

$ ./live555ProxyServer
LIVE555 Proxy Server
	(LIVE555 Streaming Media library version 2019.11.11; licensed under the GNU LGPL)

Usage: ./live555ProxyServer [-v|-V] [-t|-T <http-port>] [-p <rtspServer-port>] [-u <username> <password>] [-R] [-U <username-for-REGISTER> <password-for-REGISTER>] <rtsp-url-1> ... <rtsp-url-n>

Da unser Backend unbekannt ist, starten wir den Proxy im „Register“-Modus

screen ./live555ProxyServer -R

Auf Port 554 und 8080 wird auf Verbindungen gelauscht.

TODO Passenden Client finden, der „REGISTER“ unterstützt.

videostreaming.txt · Zuletzt geändert: 17.10.2020 12:16 von thooge

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki