I try to capture from camera with bge.Texture.VideoFFmpeg, and I want to save frame to file.raw ( byte by byte)… for some programe can process it . ( I don’t know how embed or make other C program share the same buffer with blender, if u know please share me idea )
with update() module :
from bge import texture
from bge import logic
def update():
if hasattr(logic, 'video'):
logic.video.refresh(True)
bufout = texture.imageToArray(logic.video.source,"RGB1")
#write to file cam1.raw
output = open("/home/tmp/cam1.raw", "wb")
output.write(bufout) #line 37
output.close()
Capture run well, eccept it alway throw error : line 37, in update TypeError: ‘NoneType’ does not support the buffer interface.
cam1.raw has 0 byte
I tried with property “image” (imageData) of VideoFFmpeg but it throws same err .
I using blender 2.62.
How write buffer or image Data of frame to file with python in blender 2.62 :-?.
You’d have to use the source.image object. Which is just an array of pixels+color channels. It’s possible to save that since you can read it but it’s very slow and unreliable. You never know when the object is filled. You can easily miss the moment it’s filled. This is something that can only be fixed in the C source. However that is based on my VideoFFmpeg experience…