[Solved] Native access to Webcam

Discussions about using Linux guests in VirtualBox.
Post Reply
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

[Solved] Native access to Webcam

Post by Bernard12 »

I would like to have native access Ubuntu 20.04 Virtualbox virtual machine to use my USB webcam.

On this forum, I have read and followed many suggestions, but without result.
The most detailed was viewtopic.php?f=35&t=82639#p390401 "USB basics and troubleshooting" I followed the suggestions, but without result.

And, I think, webcams are widely used, so manual configuration should be put to a minimum. My configuration is:
  • Host: Ubuntu 18.04
    Virtualbox version: 6.1.22
    Extension pack installed, with the same version
    Quest addition install, with the same version
    Virtual machine: Ubuntu 20.04
    VB USB configuration radio button selected: USB3
More info: On the host with cheese the webcam does work properly.
Host:
With the USB connected, executing

Code: Select all

lsusb
line:

Code: Select all

Bus 001 Device 006: ID 046d:08e5 Logitech, Inc.
is added, so that must be the Webcam

Code: Select all

dmesg | grep usb
results in adding:

Code: Select all

[25972.931676] input: HD Pro Webcam C920 as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/input/input35
That is correct. My Webcam is Logitech Pro WebCam C920

So I checked if VB can see my USB connection:

Code: Select all

bernard@p10:~$ vboxmanage list usbhost
Host USB Devices:
<none>
bernard@p10:~$


So it seems like Virtualbox does not recognized the USB webcam

Which is weird, because executing:

Code: Select all

bernard@p10:~$ vboxmanage list webcams
Video Input Devices: 2
.1 "HD Pro Webcam C920"
/dev/video0
.2 "HD Pro Webcam C920"
/dev/video1
bernard@p10:~$ 
It is recognized by vboxmanage. Even two times. The reason is unknown, i do not like that, but I am not the only one.
See viewtopic.php?f=3&t=96023&p=465577&hilit=webcam#p465577

In the VM Menu -> Devices -> Webcams i see two webcams, with checkboxes. I checked them separately, but without result. When I remove my USB connection, the webcam entries are gone to. So the VM sees the Webcam.

But, which is strange VM

Code: Select all

lsusb
could not find the webcam USB when connected.

On the VM I configuration the USB-filter, according to the tread "USB basics and troubleshooting" but without result. Later I read, USB-filters should not be used, and removed. I did so, also without result.

Starting cheese in the VM, cheese can not find a device. In viewtopic.php?f=3&t=101924&p=494984&hil ... am#p494984 guvcview is advised to use.
I installed GUVCVIEW: version 2.0.6 but also Guvcview could not find a device.

So I am stuck. But I feel, because the wide use of Webcams, it should be quite easy, with a simple VB configuration. What am I doing wrong? Why there are two entries on the host, and the VM? And how can I use my Webcam in a Ubuntu VirtualBox VirtualMachine?
Attachments
VBoxSVC.zip
(2.31 KiB) Downloaded 9 times
Last edited by Bernard12 on 12. Jun 2021, 07:50, edited 4 times in total.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Native access to Webcam

Post by scottgus1 »

Bernard12 wrote:"USB basics and troubleshooting" I followed the suggestions
There are suggestions that may help in step 8 of that tutorial.

Also see https://www.virtualbox.org/manual/ch09. ... assthrough
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Native access to Webcam

Post by fth0 »

Bernard12 wrote:What am I doing wrong?
Your initial posting sounds like you're doing it right, especially after you found my postings in the other thread. To sum it up from my point of view:

To capture the webcam, I did not use any USB filter, but only the VM's Devices > Webcams menu entries. I can select one or both menu entries; the "other" one is for the possibly available IR functionality, and in some cases even exists when a webcam doesn't support IR. Then, when I want to use the cheese app inside the guest, I must run it with the necessary environment setting GST_V4L2_USE_LIBV4L2=1, whereas gucview works for me without it.
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@scottgus1 I added the requested addition info. I followed https://www.virtualbox.org/manual/ch09. ... assthrough , I did not change the optional settings, and I did not have a positive result. The only difference I can see, by executing this statement, in the VM, Menu ->: Devices-> Webcam 1, the checkbox is already checked.
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@fth0, guvcview does not work for me. And for cheese, where can I alter these settings?
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Native access to Webcam

Post by fth0 »

Bernard12 wrote:And for cheese, where can I alter these settings?
For a test, open a terminal inside your guest OS, and simply enter

Code: Select all

GST_V4L2_USE_LIBV4L2=1 cheese
As a general tip: In your original post, you tested a lot of aspects, but it's not clear to me what you knew at what time, so perhaps it would make sense to start afresh, and using your accumulated knowledge to verify one step after the other. When I tested everything myself in March, it took me over an hour, and I was only missing the webcam related knowledge when starting.
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@fth0 I did so,cheese was starting but without finding a camera.

Code: Select all

GST_V4L2_USE_LIBV4L2=1 cheese
** Message: 19:19:40.506: cheese-application.vala:214: Error during camera setup: No device found
I feel like a Webcam should be easily connected. A Webcam, and also a USB webcam is a common device. That is why I asked for "native acces" without the need of all manual steps. But I tried to solve it first my self, without bordering people on this forum. This resulted in the many checks I made.

For my feeling it should be something simple, we overlooked. After all it is just a common USB Webcam
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@scottgus1 Could you do something with the info I send on your request?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Native access to Webcam

Post by scottgus1 »

When I get a chance. (Just to let you know, these forums are run by fellow users who volunteer their time, so posters have to wait for someone who has time and knowledge to come along.)
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@scottgus1 Ok thanks, I will wait and hope someone find a solution.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Native access to Webcam

Post by fth0 »

Bernard12 wrote:"USB basics and troubleshooting" I followed the suggestions
The user bernard is not a member of the vboxusers group, and therefore not allowed to access any USB devices from within VirtualBox. Please try again. ;)
Bernard12
Posts: 47
Joined: 10. Dec 2020, 17:45

Re: Native access to Webcam

Post by Bernard12 »

@fth0 Thats it. Thanks lth0. I used

Code: Select all

GST_V4L2_USE_LIBV4L2=1 cheese
With hind side it is logical. But in advance that is hard. A proper (error) message could have helped so I could find it myself.
Post Reply