An idea. The first time you play it, cache each frame.
After it finishes, start playing from the cache. Untested:
Local movieLength# = 3.45 ;Seconds.
Local movieFPS = 30 ;Rate with which you wish to capture\reproduce the movie.
Local TOTAL_FRAMES# = (movieLength * movieFPS) + 3 ;The '+3' is to add some safety padding.
Local captureTimer = CreateTimer(movieFPS)
Local captureFrame = 0
Local cachedMovie = CreateImage(w, h, Int(TOTAL_FRAMES)) ;Create an AnimImage.
Local originalMovie = OpenMovie("movie.avi")
;First time:
While MoviePlaying(originalMovie)
WaitTimer(movieFPS)
DrawMovie originalMovie, x, y, w, h
GrabImage cachedMovie, 0, 0, captureFrame
captureFrame = captureFrame + 1
Flip
Wend
;Second time, up to eternity:
Local tempFrame = 0
While Not KeyHit(1)
WaitTimer(movieFPS)
DrawImage cachedMovie, x, y, tempFrame
tempFrame = tempFrame + 1
If tempFrame > captureFrame then tempFrame = 0 ;Loop the footage.
Flip
Wend
End EDIT: A much safer way is to externally convert the movie file to a sequence of JPEGs etc., then load, capture and free each separate image with GrabImage as a frame of a single Blitz3D AnimImage - you're not required to use an AnimImage, but having all frames stored inside the single Blitz3D Image is slightly more convenient (and I think you have less memory footprint than keeping each frame as a separate Blitz3D Image).
Last edited 2012
|