I have two commands, one that lets me record my screen to an AVI video file, and another which lets me stream a video file as a (fake) "webcam". This is really useful in apps that doesn't support selecting one screen to share (I'm looking at you Slack).
command #1 (https://askubuntu.com/a/892683/721238):
ffmpeg -y -f alsa -i hw:0 -f x11grab -framerate 30 -video_size 1920x1080 -i :0.0+1920,0 -c:v libx264 -pix_fmt yuv420p -qp 0 -preset ultrafast screenStream.avi
command #2 (https://unix.stackexchange.com/a/466683/253391):
ffmpeg -re -i screenStream.avi -map 0:v -f v4l2 /dev/video1
Why can't I just run both of these in parallel? Well, the second command starts streaming from the beginning of the file, whenever I use my "webcam". So I have to time it really close, otherwise there is latency.
I've tried lots and lots of solutions (including solutions with gstreamer instead of ffmpeg), can't get anything to work. This is my last hope.
How can I stream my desktop/screen to /dev/video1 as a (fake) "webcam" on Ubuntu?

