Webcam player

That works better thanks Nick - however still a 1 second latency from camera to video texture.

Ideas?

What about Vsync? Where can I turn that off in blender? or any special codec I need?

  • 1 second latency? I do not know how to solve this question, the script is not mine - it just was in my archive.

Thanks Nick - do you know how to make bge.texture.FilterBlueScreen work with your example?

Is anyone else experiencing bad latency on the webcam blend?

I had a problem like that in my own webcam project. I ended up buying a new webcam and that solved the problem. So i suggest you try with other webcams, to see if you get different results.

I thought your script work find. In fact, it worked on the early Android smartphone. However, it does not recognize the ‘linux2’ OS API. Do you have any ideas? In addition, now the sound file is not read in Blender Player for Android, can you help on this matter also. I think think it has to do with system that Authenticates Process thread with today’s Android Phone. A lot of Blender logic blocks and Node has this built in due to the compilers used by the organization (Netbeans, QTCreator, QDeveloper, Eclipse. and etc…) and get some sort of certification stamp during application use. .

I was wondering if their is a link to the update version for Android. When this code first came out, you could play it on Android because it listed Android of Linux2. Here is the two file that appear to work in linux and windows. It also has the linux2 api.

//videoStart_etude.py
import bge
import sys
from bge import texture

contr = bge.logic.getCurrentController()
obj = contr.owner

if not hasattr(bge.logic, ‘video’):
if sys.platform == ‘win32’ or ‘cygwin’:
pathCam = 0
elif sys.platform == ‘linux’ or ‘linux2’:
pathCam = “/dev/video0”
matID = texture.materialID(obj, ‘MAVideoMat’)
bge.logic.video = texture.Texture(obj, matID)
bge.logic.vidSrc = texture.VideoFFmpeg("", pathCam, 5, 640, 480)
bge.logic.vidSrc.scale = True
#bge.logic.vidSrc.filter = bge.texture.FilterBGR24()
#bge.logic.vidSrc.filter = bge.texture.FilterGray()

if contr.sensors[0].positive:
bge.logic.video.source = bge.logic.vidSrc
bge.logic.vidSrc.play()

refresh video Videoupdate.py

import bge
if hasattr(bge.logic, ‘video’):
bge.logic.video.refresh(True)

I did download webcam.blend what me do with that how on my webcam not see feed what next ?? thanks.

I tried the script on a Snapdragon WIndows 11 machine…not lag at all. The sharpest of the camera was high.