VideoFFmpeg: image

image
  • Returns the image data.

Return Type: 

  • integer list [r,g,b,a] for every pixel in the displayed image

a:

  • alpha color channel
  • Type:  integer
  • Range: 0 to 255
b:
  • blue color channel
  • Type:  integer
  • Range: 0 to 255
g:
  • green color channel
  • Type:  integer
  • Range: 0 to 255
r:
  • red color channel
  • Type:  integer
  • Range: 0 to 255
Sample Code

###################### get image data

# import bge module
import bge

# get the current scene
scene = bge.logic.getCurrentScene()

# get list of objects in scene
objList = scene.objects

# get object named MovieScreen
obj = objList["MovieScreen"]

# check to see if Video FFmpeg Texture was saved as an object variable
# in other words, was the movie started

if "Video" in obj: 

# get the saved object variable
video = obj["Video"]

# get the displayed video image data
image_data = video.source.image
  
# update the video texture
video.refresh(True)

else:
 
# get matID for the movie screen
# my material is named Display
matID = bge.texture.materialID(obj, "MADisplay")
   
# get the video texture
video = bge.texture.Texture(obj, matID)
      
# get the name of the movie
movieName = "BigBuckBunny.ogg"
      
# get movie path
# movie is in same directory as blend
movie = bge.logic.expandPath('//' + movieName)
      
# get video texture source
video.source = bge.texture.VideoFFmpeg(movie)
      
# save video as an object variable
obj["Video"] = video
   
# start the video
video.source.play()