Skip to content
Home ยป Using your webcam in a virtual machine with VirtualBox

Using your webcam in a virtual machine with VirtualBox

Setting up an (integrated) webcam to use in Ubuntu inside VirtualBox can be a tough nut to crack. However, with this guide, it should only take you a couple of minutes.

If you’re running Microsft Windows as your host operating system (OS), open an elevated command prompt (right click on cmd and run as administrator). Furthermore, please make sure that you can access VBoxManage. This is the tool that comes with Oracle VirtualBox that allows you to control your VirtualBox image from the command line of your host OS. If you cannot access it and you get the following error, please follow this short guide.

‘VBoxManage’ is not recognized as an internal or external command, operable program or batch file.

If the VBoxManage command is properly working, type the following command to list all the webcam devices. If you don’t see any errors, please scroll down to the area below the horizontal line.

VBoxManage list webcams

However, if you thought this would work properly but instead got the following error, please download the VM VirtualBox Extension Pack and install it on your computer. Make sure to turn off your VM.

VBoxManage.exe: error: No extension pack by the name 'Oracle VM VirtualBox Extension Pack' was found.

If you run into the following error, please follow the steps below the image.

VBoxExtPackHelperApp.exe: error: Failed to rename the temporary directory to the final one: ERR_ACCESS_DENIED
VBoxExtPackHelperApp.exe: error: Failed to rename the temporary directory to the final one: ERR_ACCESS_DENIED
  1. Browse to the folder where you installed VirtualBox. The default folder is ‘C:\Program Files\Oracle\VirtualBox’.
  2. Next, right click on the folder named ‘ExtensionPacks’ and go to the tab Security.
  3. Click Edit
  4. In the list, select Users (LAPTOPNAME/Users)
  5. Give it Full Control
  6. Rerun the installer
  7. In your elevated command prompt, run the following command again:
VBoxManage list webcams

You should see an output like this. The thing I hid from you is the directory to where my integrated webcam is installed (it’s very long).

Finally, start up your VM and run the following command, where you replace the image name and the path to the webcam with your specific values. Tips:

  • If the directory name is long, you can copy from your cmd using control+C.
  • If your directory contains spaces or weird characters, wrap them in double quotes.
VBoxManage controlvm <image_name> webcam attach <path_to_webcam>

Congratulations, you can now use your webcam in your virtual machine!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

8 thoughts on “Using your webcam in a virtual machine with VirtualBox”

  1. Hi! I followed your tutorial from start to finish but I still get this weird error:
    VBoxManage.exe: error: Code E_FAIL (0x80004005) – Unspecified error (extended info not available)
    VBoxManage.exe: error: Context: “WebcamAttach(path.raw(), settings.raw())” at line 2150 of file VBoxManageControlVM.cpp

    I am using Windows 10 host machine with Ubuntu 20.04.1 as my Virtual OS. Also, I have only 1 webcam. Could this be the issue?

  2. What tto do if I wnat to use the camera on my MacOS Vrtual Machine in virtual box? the hst is Windows on Dell

Leave a Reply

Your email address will not be published. Required fields are marked *