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

Using your webcam in a virtual machine with VirtualBox

  • by
webcam for virtualbox
Want to do a random act of kindness? Share this post.

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!

Want to do a random act of kindness? Share this post.