I was able to stream desktop in virtual webcam using this command:

sudo modprobe v4l2loopback exclusive_caps=1 && v4l2-ctl --list-devices && ffmpeg -f x11grab -r 20 -s 400x400 -i :0.0+50,100 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1

After installing all dependencies on ubuntu 17.04 the desktop streaming does not work and I see only a black screen.

Are there any alternatives that would allow me to record desktop and share it in a webcam?

I want to work with the desktop recording in webcam because of opencv.

I could not find any other working alternative.


Can't install this one because of E: The repository 'https://content.runescape.com/downloads/ubuntu trusty InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default.

Open Broadcaster Software

This one looked amazing until I found out that it cannot stream the desktop into a webcam for some reason...

  • What are you using to view the output from ffmpeg? The console output from ffmpeg would be informative.
    – llogan
    Dec 7 '17 at 2:01

If you don't mind a GUI, VLC VideoLAN can stream video on Linux (and on Windows) platforms. If it not in the Ubuntu Software center, then just enter:

sudo apt-get install vlc

  • Can I stream the video in virtual webcam?
    – Michal
    Dec 6 '17 at 21:31
  • I haven't tried it, but VLC accepts all sources I have used, so far. N.B. it is deficient on error reporting, e.g. a long filename for output just fails without notice, so you may need to experiment a bit before it succeeds. Dec 6 '17 at 22:50
  • I mean I need to stream the video INTO the webcam. I want to record the desktop and then I want to send the desktop into webcam. So that I can read the webcam with opencv. Anyway I will take a look at it thanks.
    – Michal
    Dec 6 '17 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.