-
Notifications
You must be signed in to change notification settings - Fork 8
/
fakecamera
executable file
·17 lines (13 loc) · 752 Bytes
/
fakecamera
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# echo "Probing v4l2-loopback"
sudo rmmod v4l2loopback 2> /dev/null
sudo modprobe v4l2loopback video_nr=7 'card_label=myFakeCam'
xrandr --listactivemonitors
read -p "Which monitor you want to share: " MON_NUMBER
MON_PARSE=`xrandr --listactivemonitors | grep "$MON_NUMBER:" | cut -f4 -d' '`
MON_HEIGHT=`echo $MON_PARSE | cut -f2 -d'/' | cut -f2 -d'x'`
MON_WIDTH=`echo $MON_PARSE | cut -f1 -d'/'`
MON_X=`echo $MON_PARSE | cut -f2 -d'+'`
MON_Y=`echo $MON_PARSE | cut -f3 -d'+'`
# ffmpeg -f x11grab -r 20 -s 1920x1080 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video7
ffmpeg -f x11grab -r 20 -s "$MON_WIDTH"x"$MON_HEIGHT" -i :0.0+"$MON_X","$MON_Y" -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video7