How to save buffer from imageToArray(image,mode) in bge.texture to file in BGE ?

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 :D. ( I don’t know how embed or make other C program share the same buffer with blender, if u know please share me idea :slight_smile:

with update() module :

def update():
    if hasattr(logic, 'video'):
        bufout = texture.imageToArray(,"RGB1")
        #write to file cam.raw
        output = open("/home/tmp/cam1.raw", "wb")
        output.write(bufout)                          #line 37

Capture run well, eccept it alway throw error : line 37, in update TypeError: ‘NoneType’ does not support the buffer interface
I tried with property “image” (image data) of VideoFFmpeg but it throws same err :(.
Help me, plz :>.
I using blender 2.62.
sr my bad english.