Cookie
Electronic Team uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

VirtualBox Webcam Passthrough: Using A Host Webcam On A Guest Machine

Jul 8, 2021

When you need USB to VirtualBox passthrough, you will look for native solutions first. It is not always the simplest way to perform the task. Third-party software may make it easier to access the USB webcam in VirtualBox, but there are additional settings you may enable by yourself. The software Oracle VM VirtualBox enables a guest system to use a host machine’s webcam thanks to the feature “Webcam Passthrough”. VirtualBox Webcam Passthrough supports and enhances USB passthrough (the most common means of accessing a webcam during legacy releases).

Contents:

  1. The easiest way to access webcam in VirtualBox - Tutorial
  2. How to connect webcam to VirtualBox
  3. How to disconnect device from VirtualBox


In theory, VirtualBox Webcam Passthrough support easily manages non-USB video sources, though it has yet to be tested.

connect webcam to VirtualBox

Please Note: Webcam Passthrough modules come standard with Oracle VM VirtualBox Extension Packs, but Extension Packs will need to be installed separately.

Using VirtualBox Webcam Passthrough

Host webcams can be connected to VMs through: VM Menu Bar> Devices Menu. Users will find a list of available (host) video input devices in the webcam menu. When a user clicks the webcam name, it connects or disconnects the relevant host device.

To enable webcam passthrough, use the VBoxManage command line tool. See host-specific sections outlined below for more information.

Below is a list of available commands:

List of host webcams and video input devices

$ VBoxManage list webcams

See output format below:

Alias= "User-Friendly Name"
Host Path or Identifier


An alias is used to shortcut within other commands. The ‘.0’ alias describes the host default video input device. ‘.1’ and ‘.2’ describe the first and second (and so on and so forth) video devices. Device order is unique to each host machine.

Connect A Webcam To A Running VM Session:

Run the command:

VBoxManage controlvm VM name webcam attach [host_path|alias [settings]]

The USB webcam will now attach to the guest computer

The following shows that setting parameters are strings: “Setting1=Value1”, ”Setting2=Value2”, etc... The setting parameters allow users to configure the webcam device being emulated.

See the supported settings below:

MaxFramerate: The highest frame rate that can be sent to the guest machine. High frame rates need increased CPU power, so it’s beneficial to set lower frame rate limits.

Default = “no limit”, allowing the guest to access and utilize any and all frame rates that the host webcam can support.

MaxPayloadTransferSize: The maximum amount of bytes that the emulated webcam can transfer to the guest machine at one time.The default value used by numerous webcams is “3060”.

If the guest machine can utilize larger buffers, higher byte value can (minorly) reduce the load on a CPU. The only issue that may arise is whether a high MaxPayloadTransferSize is supported by the guest machine in use.

How to detach A Webcam From A Running VM Session:

“VBoxManage controlvm VM-name webcam detach [host_path|alias]”

List the webcams connected to an active VM as shown below:

“VBoxManage controlvm VM-name webcam list”

Per each attached webcam: the output contains the alias or path in use by the “webcam attach” command.

VirtualBox Webcam Passthrough: Windows Hosts
Emulated webcam devices automatically disconnect from guest machines when webcams are detached from host machines.

VirtualBox Webcam Passthrough: Mac OS X Hosts
Only versions of Mac OS X 10.9 or newer are compatible with VirtualBox Webcam Passthrough.

Emulated webcam devices remain connected to guest machines, even when webcams are disconnected from host machines. This means that users must manually disconnect by using the: “VBoxManage controlvm VM name webcam detach” command.

VirtualBox Webcam Passthrough: Linux and Oracle Solaris Hosts
Once the webcam is disconnected from the host, the device emulation on the guest machine automatically disconnects only if the webcam is streaming video.

If the webcam being emulated isn’t active, manual disconnection is necessary using the: “VBoxManage controlvm VM name webcam detach” command.

Aliases: ‘.0’ and ‘.1’ are both mapped to “/dev/video0”.

Alias ‘.2’ maps to “/dev/video1”

logo USB Network Gate
#1 at Network Software
USB Network Gate
Share USB over Ethernet on Windows
4.7 rank based on 72 + users
Get a download link for your desktop
Submit your email address to get a link for quick download on your desktop and get started!
or