Skypeforlinux not working with external USB Camera

I have a laptop with Ubuntu 17.10 and skypeforlinux 8.16.76. The laptop has a built-in webcam and I have connected a Logitech QuickCam IM To a USB Port (I need to use an external cam for flexibility reasons).

With the old skype 4.3, the external webcam was working very well. Now, with the skypeforlinux version 5.4 onward, the external webcam shows black frame. To be clear, the "Audio and Video Settings" shows both the cams, but when I select the external webcam, it shows black frame. The internal webcam works perfectly fine. On Windows, both the cams work fine. Also, in Cheese, both the cams work fine.

libv4l details:

mahesh@mahesh-Dell:~$ dpkg --list | grep libv4l
ii  libv4l-0:amd64                                                   1.12.5-1                                     amd64        Collection of video4linux support libraries
ii  libv4l-0:i386                                                    1.12.5-1                                     i386         Collection of video4linux support libraries
ii  libv4l-dev:amd64                                                 1.12.5-1                                     amd64        Collection of video4linux support libraries (development files)
ii  libv4l2rds0:amd64                                                1.12.5-1                                     amd64        Video4Linux Radio Data System (RDS) decoding library
ii  libv4lconvert0:amd64                                             1.12.5-1                                     amd64        Video4linux frame format conversion library
ii  libv4lconvert0:i386                                              1.12.5-1                                     i386         Video4linux frame format conversion library

What do I need to do to get skypeforlinux working with the external cam?


I had exactly the same problem and I have found a good workaround for it.

Suppose your webcam is in /dev/video0.

Please execute the following steps.

  1. Install v4l2loopback by running

    sudo apt-get install v4l2loopback-dkms
    
  2. Enable the v4l2loopback module by running

    sudo modprobe v4l2loopback
    

    This will install a virtual webcam, for example in /dev/video1

  3. Finally, when you need your webcam on Skype, just run this command.

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

This command redirects the real webcam in /dev/video0 to the virtual webcam /dev/video1 which should be recognized by Skype (it worked for me).

If you don't want to write the long ffmpeg command each time, you can save it into a script, say launch_skype_cam.sh defined below.

#!/bin/bash
ffmpeg -i /dev/video0 -vcodec rawvideo -pix_fmt yuv420p -vsync 2 -threads 0 -f v4l2 /dev/video1

Or you can set an alias, for example in your .bashrc file.

alias launch_skype_cam='ffmpeg -i /dev/video0 -vcodec rawvideo -pix_fmt yuv420p -vsync 2 -threads 0 -f v4l2 /dev/video1'