Is there a way to redirect a real webcam to a virtual webcam from the command line, for example using the v4l2loopback module with ffmpeg ?


I have an old webcam which works with most software (vlc, cheese, etc.), but not with others (Skype).

A possible workaround to make it work with such software is to redirect it to a virtual webcam using the v4l2loopback module, as done by Webcamoid, but I need to do it from the command line, for example via ffmpeg.

I am sure this is possible via ffmpeg as well, but since real webcams are rarely redirected to virtual ones, I found no examples online (the only examples I have found, like this one, redirect screen captures or existing videos to the virtual webcam instead).

  • 1
  • 2
    @LordNeckbeard The answers have something in common, but the questions are very different. That OP is asking to send a pre-recorded video (input.mp4) to an existing physical device, and the answerer suggests to use v4l2loopback instead. Here we are talking about sending a live real webcam to a virtual webcam, since this may make the webcam indirectly more compatible with some apps (e.g. Skype), which would not recognize it otherwise. In fact, the answer to that question suggests to use something like ffmpeg -i input.mp4 which is not what I was looking for here. May 29, 2018 at 18:29
  • 2
    @LordNeckbeard and that answer also shows how to grab the desktop, which not only was not what I was looking for here, but it is also very similar to this post which I already mentioned in my question. I was looking for something different, i.e. redirecting another webcam instead of the desktop or a file (as I also say in the question). I appreciate that the solutions are based on the same software, but since the questions are very different I think it is still good to share this for people who struggle with this particular problem. May 29, 2018 at 18:37

2 Answers 2


Based on this answer (already mentioned in the question) I think I have found a solution by myself, and it works with Skype!

Suppose the real webcam is in /dev/video0. When you run

modprobe v4l2loopback

the module creates a second (virtual) webcam, for example in /dev/video1. At this point, it is sufficient to execute:

ffmpeg -i /dev/video0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1

and the new virtual webcam is ready to be used and selected with Skype as well.


For me i must place LD_PRELOAD before like this :

LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so" ffmpeg -i /dev/video0 -vcodec rawvideo -pixel_format rgb24 -vsync 2 -threads 0 -f v4l2 /dev/video1

Precision : for Q4OS

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .