How to use Webcam / CameraServer / CameraFeed in 3.2 and Windows?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Maxpilot

I have a simple 3D scene, and a pluggedIn webcam. Shouldn’t CameraServer now show one CameraFeed?

Have you looked at the latest documentation for CameraFeed? Especially this part of the description?

Note: Many cameras will return YCbCr images which are split into two textures and need to be combined in a shader. Godot does this automatically for you if you set the environment to show the camera image in the background.

Ertain | 2019-12-12 16:22

yes I saw this. I built a simple scene with only a camera, put an environment to this camera and set the background to “CameraFeed”, full energy and CameraFeed Id 1. I don’t know if I’m totaly wrong, but I think for this to work there has to be a CameraFeed yet. When testing this with


that gives “0”. So no chance to set a CameraFeed to “active”. Also tried to instanciate one with “”, but looks like this one has no connection to any physical device. Totaly lost in figuring out how this should work, but I guess there has to be a CameraFeed in CameraServer as soon as you connect a physical device.

Maxpilot | 2019-12-12 18:15

:bust_in_silhouette: Reply From: rolfpancake

I also tried it but then I noticed that it isn’t possible right now - at least if you are not working with iOS/OSX.
If you follow the discussion in the PR you see that Bastiaan had problems getting this running on Windows, Linux and Android. Android will soon get a working implementation by using ARCore.

As I wasn’t sure that this might be implemented in the meantime I checked the godot repository and saw this:

#include "camera_win.h"

///@TODO sorry guys, I got about 80% through implementing this using DirectShow only
// to find out Microsoft deprecated half the API and its replacement is as confusing
// as they could make it. Joey suggested looking into libuvc which offers a more direct
// route to webcams over USB and this is very promising but it wouldn't compile on
// windows for me...I've gutted the classes I implemented DirectShow in just to have
// a skeleton for someone to work on, mail me for more details or if you want a copy....