Blender Game Engine provides capability to use video sources as textures. Problem is it uses ffmpeg and it’s not very good for access to Windows webcams. I’ve came across this problem recently and found a workaround – external python module VideoCapture. It uses DirectShow so it should be able to use almost every webcam on Windows.

VideoCapture installation
Blender 2.62 uses Python 3.2, so it’s necessary to find module built for for this version. It’s located on Python Extension packages for Windows page. Choose proper build (VideoCapture-0.9.4.win-amd64-py3.2.exe or VideoCapture-0.9.4.win-win32-py3.2.exe) and install it into your Python installation.
If Blender doesn’t recognize installed module, copy file vidcap.pyd and folder VideoCapture to folder 2.62\python\lib in Blender installation. Then it should work correctly.

Example
I made a basic example. It creates dynamic texture, webcam device and it loads image from device to texture every frame. Device ID is defined as object’s property.

12 thoughts on “WebCam in Blender Game Engine 2.62

  1. I can’t seem to get this to work for me, what is expected for device ID? the name? or capture=0, 1, 2 etc like vfw capture expects

  2. Console says videocapture is missing, where do I install it? Also doesn’t 2.5/6 use python 3.2?

  3. thank you very much for your approach, making it public and giving these useful tips! for me as a non programmer and phython-dummy it was extremely useful to see what could be done in the bge and where to start… installing all this python stuff, even blender has built in python 3.2 – but for these extra modules you have to and afterwards copy it into the blender lib folder, also the PIL libary, was all in all not easy and took me many hours, but it works… when I have something useful, I’ll give also a comment. thank you again!

  4. Zdravím, rád bych se zeptal na radu jak upravit demo artoolkitu tak aby fungovalo v současné verzi blenderu..zda-li je to vůbec možné…v čem bude problém..atd. díky moc!

    1. Ahoj, zrejme bude treba rekompilovať PyARTK zo zdrojákov, aby fungovalo na verzii Pythonu použitej v Blenderi 2.70. Bude to chcieť trochu výskumu, pozriem sa na to, keď mi vyjde voľný čas.

      1. Ahoj..no to by bylo naprosto skvělé! Kdyby to bylo něco náročnějšího určitě bych byl ochoten finančně přispět! Když tak mi napiš na mail. dík!

        1. Ahoj,
          narazil som na problém s numpy v aktuálnej verzii Pythonu 3.4 – snažím sa túto knižnicu z wrappera vyhodiť (aj tak je tam používaná len na správu bufferov). Ide to pomaly, ale dám vedieť, keď budem mať nejaký výsledok.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.