1

I am trying to use my Canon 7D as a webcam on Kubuntu 19.10. I managed to connect the camera using gphoto2 and pipe the video stream to a video device with this following command:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video2

I am able to confirm this works - I am able to view the stream using ffplay /dev/video2 and even in some online services (like Whereby, Jitsi Meet or Zoom) I am able to use my custom webcam (Although its name appears to be Dummy video device (0x0000)).

But when trying to use other services - like Google Hangouts, Slack or Facebook Messenger, only my internal laptop webcam is offered. I suspect the video4linux2 webcam uses some less common codec, that is not as widely supported as the codec that is used by my internal webcam. But that is just my wild guess, I am in no way experienced with video codecs and video conversion.

I will be very thankful for any advices how to make my Canon 7D webcam with more services for videocalls.


Edit: Here is the output of the command I use to create a virtual webcam with video from the Canon 7D camera:

Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort.
ffmpeg version 4.1.4-1build2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.2.1-4ubuntu1)
  configuration: --prefix=/usr --extra-version=1build2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1build2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  avfilter    configuration: --prefix=/usr --extra-version=1build2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[mjpeg @ 0x55672f94c680] Format mjpeg detected only with low score of 25, misdetection possible!
Input #0, mjpeg, from 'pipe:':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1056x704, 25 tbr, 1200k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))
[swscaler @ 0x55672f9b6f80] deprecated pixel format used, make sure you did set range correctly
Output #0, video4linux2,v4l2, to '/dev/video2':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1056x704, q=2-31, 223027 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.35.100 rawvideo

Edit 2: By following the steps from this post - Use webcam from laptop on desktop pc (thanks to @Raff for linking it), I was able to make the webcam work on Slack, but still not on Google Hangouts.

Namely I used these steps to make the webcam work with Slack:

sudo modprobe -r v4l2loopback
sudo depmod -a
sudo modprobe v4l2loopback exclusive_caps=1 card_label="Canon7D:Canon7D"
jenda
  • 219
  • Show the complete console output from your command. – llogan Apr 17 '20 at 18:04
  • Hi, I just added the console output. – jenda Apr 17 '20 at 18:22
  • 1
    Load the module with exclusive_caps=1 option and give your cam a name like so sudo modprobe v4l2loopback exclusive_caps=1 card_label="MyLaptopCam:MyLaptopCam" . See this answer for extra information – Raffa Apr 17 '20 at 18:49
  • @Raffa Thank you! I don't know how didn't find this post earlier. I followed the steps for PC and it seems that by running depmod -a and then sudo modprobe v4l2loopback exclusive_caps=1 card_label="MyLaptopCam:MyLaptopCam" solved it partially. I am now able to use the camera in Slack, but Google Hangouts (in browser) still offer only the integrated laptop cam (I tried to restart Firefox, but that didn't help). – jenda Apr 17 '20 at 18:57
  • Did you install all the needed software like described in the post including sudo apt install v4l2loopback-dkms v4l2loopback-utils? Try to start allover and install following the steps. It works on both Firefox and google Chrome. Do a sudo apt update && sudo apt upgrade first and reboot after package installation. – Raffa Apr 17 '20 at 19:07
  • Yes, I followed the whole "On the PC" chapter and made sure I have all dependecies up to date. Tried restarting the computer, but the situation is still the same - it works on Slack, but not yet on Google Hangouts on Firefox (but it probably isn't a Firefox issue, since it works on Whereby on Firefox). – jenda Apr 17 '20 at 19:17
  • The v4l2loopback is not 100% compatible with all applications, that is a fact. Try using Google Hangouts in Google Chrome and see if it works there. – Raffa Apr 17 '20 at 19:45
  • Oh, I think I figured it out. Firefox and neither Chrome didn't offer my custom webcam when requesting permissions for camera on Hangouts (but other web apps did allow starting straight with the custom camera), but I was able to switch the cameras by allowing the integrated webcam first and the changing the camera in the camera selector, that is a part of Hangouts (and approving the permission request again).

    Thank you very much for your help.

    – jenda Apr 17 '20 at 20:08
  • Well done : ) and you are most welcome. If you can add how you managed to use it with hangouts as a comment under the answer I linked above to help others, that would be helpful – Raffa Apr 17 '20 at 22:16
  • There might be more ways to do this, but this was my method in Mozilla Firefox: Open Google Hangouts, start a videocall and allow both requests for microphone and internal webcam. Then click the cogwhell icon to open a settings dialog that allows you to choose which webcam you want to use. Select your virtual webcam, accept the permission request and click "done". Also this setting seems to persist to future videocalls - next time I found my virtual webcam already selected and working. :) – jenda Apr 18 '20 at 10:03

0 Answers0