Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 5th, 2013  |  syntax: Bash  |  size: 1.49 KB  |  views: 78  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2.  
  3. #Main screen grab
  4. INRES="1920x1080"                                               # input resolution
  5. DISPLAY=:0.0+0,0
  6.  
  7. #Key-mon                                       
  8. INRES2="240x35"
  9. DISPLAY2=:0.0+3360,1045
  10.  
  11. #Webcam
  12. INRES3="800x600"
  13. DISPLAY3=:0.0+2700,100
  14.  
  15. OUTRES="1280x720"                                               # Output resolution
  16. FPS="25"                                                        # target FPS
  17. BITRATE="3000k"                                                 #Video output Bitrate
  18. STREAM_KEY=""   # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other
  19.  
  20. # Get sink monitor:
  21. MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \
  22.     grep 'Name: .*iec958-stereo\.monitor$' | awk '{print $NF}' | tail -n1)
  23. echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null
  24.  
  25. MIC=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \
  26.     grep 'Name: .*ad01\.analog-mono$' | awk '{print $NF}' | tail -n1)
  27. echo "set-source-mute ${MIC} false" | pacmd >/dev/null
  28.  
  29. rm test.flv
  30.  
  31. 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|\
  32. /home/felix/Documents/ffmpeg/build/ffmpeg       -f x11grab -s $INRES -r $FPS -i $DISPLAY \
  33.         -f x11grab -s $INRES2 -r $FPS -i $DISPLAY2 \
  34.         -f v4l2 -s $INRES3 -r 10 -i /dev/video0 \
  35.         -f sox -i - -ac 2 \
  36.         -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" \
  37.         -vcodec flv1 -s $OUTRES -pix_fmt yuv420p -b:v $BITRATE \
  38.         -acodec libmp3lame -b:a 96k -ar 44100 -ac 2 \
  39.         -threads 0 \
  40.         -f flv "rtmp://192.168.2.106/live/cirk"