Using AVI's directly

Blitz3D Forums/Blitz3D Programming/Using AVI's directly

Not sure if it can be done in 3D, let alone in 2D with blitz...

Has anyone had any success with loading and displaying an AVI ?. I dont mean with an external DLL, but with blitz instructions.

I was just having a look at 'Heart of Darkness' - wondering if it would be possible to do something like it with blitz. The main game is a very simple affair, guess most of the CPU time can be taken up processing the AVI.

From what I've seen of the AVI format, it doesnt mask with a background.. so I'd have to get down & dirty in the rendering loop itself, checking the pixels as they are displayed. (if its not too slow !)

And NO I dont want to use animated textures..

there are some movie commands in blitz - if it's that what you're after? bare in mind the user must have the codec installed.

Works fine BUT its like Music you have to load/play the AVI when its required and not before.

The commands you want are PlayMovie and DrawMovie. Make sure you have a fairly recent update.

Maybe I understood something wrong - but Blitz3D can map the stream of an AVI to a brush. As far as I know you cannont do Alpha Channels (that would be great). What you can or cannot do, depends on the installed codecs. If it works in the Media Player, it will also work in Blitz.

This code (from Skully) displays a movie on a cube.
Graphics3D 800,600,16
cam=CreateCamera()
light=CreateLight(2,cam)

moviefilename$ = "movie.avi"
movie=OpenMovie( moviefilename$ )
mw=MovieWidth(movie)
mh=MovieHeight(movie)
texture=CreateTexture(mw,mh)
toX=(TextureWidth(texture)-mw)/2
toY=(TextureHeight(texture)-mh)/2
sprite=CreateCube()
EntityTexture sprite,texture
MoveEntity sprite,0,0,3

Repeat
    While MoviePlaying(movie) And (Not KeyDown(1))
		TurnEntity sprite,0,1,0
        If KeyDown(200) Then TurnEntity sprite,-5,0,0
        If KeyDown(208) Then TurnEntity sprite,5,0,0
        If KeyDown(203) Then TurnEntity sprite,0,-5,0
        If KeyDown(205) Then TurnEntity sprite,0,5,0
        SetBuffer TextureBuffer(texture)
        DrawMovie (movie,toX,toY)
        SetBuffer BackBuffer()
        UpdateWorld:RenderWorld
        Text 250,0,"Movie playing To 3d Object by Skully"
        Text 320,20,"Arrows rotate screen"
        Flip
    Wend
    movie=OpenMovie(moviefilename )
Until KeyHit(1)

End