LibrePlanet: Conference/2016/Streaming

From LibrePlanet
Jump to: navigation, search
(OpenBroadcaster 2 v4l)
(OpenBroadcaster 2 v4l)
Line 29: Line 29:
  
 
This instructions are for building OpenBroadcaster on Debian 8 stable, plus ffmpeg as a dependency.
 
This instructions are for building OpenBroadcaster on Debian 8 stable, plus ffmpeg as a dependency.
 +
 
'''NOTE''' that for OBS to run it is necesary OpenGL 3.2. If using Intel graphics, Debian ''testing'' is needed.
 
'''NOTE''' that for OBS to run it is necesary OpenGL 3.2. If using Intel graphics, Debian ''testing'' is needed.
  

Revision as of 16:47, 11 March 2016

Keynote capture script

#!/bin/bash

xid=$(xwininfo  -root -all|grep "Jitsi Meet" | sed -e 's/^ *//' | cut -d\  -f1)
[ 1${xid}1 != 11 ] && xidparameter="xid=$xid"

export GST_DEBUG=4
DATE=$(date +%Y-%m-%d-%H_%M_%S)
PASSWORD=xxx

# pactl list|grep alsa_output
device1="alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo.monitor"
device2="alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo"

gst-launch-1.0 --gst-debug-level=$1 --eos-on-shutdown ximagesrc use-damage=false $xidparameter show-pointer=false !\
 videoconvert ! videorate ! video/x-raw,framerate=20/1 ! videoscale ! video/x-raw, width=1024, height=768 !  \
 vp8enc min_quantizer=1 max_quantizer=10 cpu-used=10 deadline=41000 threads=2 ! queue ! mux. \
 pulsesrc device=$device1 ! adder name=mix ! vorbisenc  quality=0.4 ! queue ! mux. \
 pulsesrc device=$device2 ! mix. \
 webmmux streamable=true name=mux ! queue ! tee name=s ! queue ! filesink location=keynote-${DATE}.webm \
 s. ! queue leaky=2 ! shout2send ip=live2.fsf.org port=80 mount=keynote.webm password=$PASSWORD sync=false 2>&1 |\
 tee keynote-${DATE}.log

OpenBroadcaster 2 v4l

This instructions are for building OpenBroadcaster on Debian 8 stable, plus ffmpeg as a dependency.

NOTE that for OBS to run it is necesary OpenGL 3.2. If using Intel graphics, Debian testing is needed.

Building/installing:

Install dependencies:

# apt-get install build-essential pkg-config cmake git checkinstall libx11-dev libgl1-mesa-dev \
libpulse-dev libxcomposite-dev libxinerama-dev libv4l-dev libudev-dev libfreetype6-dev \
libfontconfig-dev qtbase5-dev libqt5x11extras5-dev libx264-dev libxcb-xinerama0-dev \
libxcb-shm0-dev libjack-jackd2-dev libcurl4-openssl-dev zlib1g-dev yasm gstreamer-tools

Download and build ffmpeg:

$ git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
$ cd ffmpeg
$ ./configure --enable-shared --prefix=/usr
$ make -j4

# checkinstall --pkgname=FFmpeg --fstrans=no --backup=no \
    --pkgversion="$(date +%Y%m%d)-git" --deldoc=yes

Download and build obs:

$ git clone https://github.com/jp9000/obs-studio.git
$ cd obs-studio
$ 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

Install v4l loop:

# apt-get install v4l2loopback-dkms
# echo v4l2loopback >> /etc/modules
# modprobe v4l2loopback


Install local stream manager:

# apt-get install crtmpserver

Setup

Run obs, set streaming settings to:

  • URL: rtmp://127.0.0.1/flvplayback
  • Stream Key: stream

Test streaming:

$ gst-launch-1.0 rtmpsrc location="rtmp://127.0.0.1/flvplayback/stream.flv live=1"  ! decodebin ! xvimagesink sync=false

Run streaming to v4l:

# modprobe snd-aloop
# echo snd-aloop >> /etc/modules
$ gst-launch-1.0 rtmpsrc location="rtmp://127.0.0.1/flvplayback/stream.flv live=1" ! decodebin name=decoded ! videorate !\
video/x-raw,framerate=25/1 ! queue leaky=1 !  v4l2sink device=/dev/video1 sync=false \
decoded. ! audioconvert ! queue leaky=1 ! pulsesink device=alsa_output.1.analog-stereo sync=false

Test v4l device:

$ gst-launch-1.0 v4l2src device=/dev/video1 ! xvimagesink