#!/bin/sh #Main screen grab INRES="1920x1080" # input resolution DISPLAY=:0.0+0,0 #Key-mon INRES2="240x35" DISPLAY2=:0.0+3360,1045 #Webcam INRES3="800x600" DISPLAY3=:0.0+2700,100 OUTRES="1280x720" # Output resolution FPS="25" # target FPS BITRATE="3000k" #Video output Bitrate STREAM_KEY="" # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other # Get sink monitor: MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \ grep 'Name: .*iec958-stereo\.monitor$' | awk '{print $NF}' | tail -n1) echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null MIC=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \ grep 'Name: .*ad01\.analog-mono$' | awk '{print $NF}' | tail -n1) echo "set-source-mute ${MIC} false" | pacmd >/dev/null rm test.flv sox --multi-threaded -t raw -e si -b 16 -r 44100 -c 2 "|parec --rate=44100 --channels=2 -d $MONITOR" -t raw -e si -b 16 -r 44100 -c 2 "|parec --rate=44100 --channels=2 -d $MIC" -m -p gain rate 44100|\ /home/felix/Documents/ffmpeg/build/ffmpeg -f x11grab -s $INRES -r $FPS -i $DISPLAY \ -f x11grab -s $INRES2 -r $FPS -i $DISPLAY2 \ -f v4l2 -s $INRES3 -r 10 -i /dev/video0 \ -f sox -i - -ac 2 \ -filter_complex "[2:0]scale=in_w/3:in_h/3[cam];[0:0][1:0]overlay=0:200[a];[a][cam]overlay=0:0" \ -vcodec flv1 -s $OUTRES -pix_fmt yuv420p -b:v $BITRATE \ -acodec libmp3lame -b:a 96k -ar 44100 -ac 2 \ -threads 0 \ -f flv "rtmp://192.168.2.106/live/cirk"