Video Texture VideoFFmpeg: framerate

framerate
  • get/set the video speed

Type:

  • Type: float
  • 0.5 = half of the normal video speed.
  • 1.0 = the normal video speed.
  • 2.0 = twice the normal video speed.
  • etc.
Sample Code

###################### get the video speed

# 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 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 vidoe texture source
video.source = bge.texture.VideoFFmpeg(movie)

# get video framerate speed
speed = video.source.framerate
      
# save video texture as an object variable
obj["Video"] = video
   
# start the video
video.source.play()
 
Sample Code

###################### set the video speed
# 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 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)

# set the video to 5 times normal speed
video.source.framerate = 5.0
      
# save video texture as an object variable
obj["Video"] = video
   
# start the video
video.source.play()