WebCam in Blender Game Engine 2.62

Saturday , 10, March 2012 12 Comments

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.

Zdieľajte tento článok...
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
12 thoughts on “ : WebCam in Blender Game Engine 2.62”
  • Kassandra says:

    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

  • admin says:

    DeviceID = 0 worked for my notebook webcam. What is written in console window?

  • Kassandra says:

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

  • admin says:

    I’ve updated article to explain installation process.

  • Laco says:

    Where can I find PIL for python 3.2 please? thanks

  • Laco says:

    it could be found there : http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil 😛 just more google

  • Simeon says:

    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!

  • Jonáš says:

    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!

    • Ash says:

      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.

      • Jonáš says:

        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!

      • Jonáš says:

        Ahoj, nějaký progres? 😀 díky za info!

        • Ash says:

          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.

  • Please give us your valuable comment

    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.