VideoFFmpeg: VideoFFmpeg

VideoFFmpeg(movie)
  • Returns a Video FFmpeg Texture Object.

Formats and Codecs:

  • All FFmpeg supported video formats and codecs.
     
  • Including but not limited to: avi, mpeg, ogg and xvid.

movie:

  • Video name and path.
  • Type: string
Sample Code

###################### play movie

# 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"]
   
# update the video
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 texture as an object variable
obj["Video"] = video
   
# play the video
video.source.play()