Issues with playing movies

Blitz3D Forums/Blitz3D Beginners Area/Issues with playing movies

zortzblatz(Posted 2008) [#1]
Whenever I try to get my code to play a movie it plays the audio but does not show any of the frames of the movie, does anyone know why or have a fix?


Include "cwint.bb"
Cls

movie = OpenMovie("cut\teaser.wmv")
If movie=0 Then RuntimeError "Error - Movie not loaded!" 
If Not(MoviePlaying(movie)) Then RuntimeError "Error - Movie not playing!" 
w=MovieWidth(movie) 
h=MovieHeight(movie) 
x=(WIDTH-w)/2 y=(HEIGHT-h-100)/2 
Repeat 

DrawMovie movie,x,y,w,h
Cls
Flip
Until KeyHit(1)

CloseMovie movie




Ginger Tea(Posted 2008) [#2]
codecs?
even if wmp or your movie player of choice has oodles of codecs installed blitz might only like the default wma and mpg codecs and throw a hissy at things like divx and other wma's


zortzblatz(Posted 2008) [#3]
I am not sure what the codec is, do you see any errors in my code which could be causing my problem?


Ginger Tea(Posted 2008) [#4]
a codec is a separate file that handles audio visual data and is separate from this and other programming languages

windows media player can play default wmv/wma and mpg/mp3's but without a codec it cannot do divx movies or 'custom' wmv (sound will play on most)

so if your movie has been saved with a custom codec that blitz doesnt understand or have access to then just audio is probably all it can access

try re-saving the movie under default conditions


zortzblatz(Posted 2008) [#5]
My movie was made by Windows Movie Maker if that helps. I've tried it as both a wmv and an mpg. Both times I get the same result, the sound plays, but I see nothing. Every other program on my computer is fine with the movie.

The second video file is mpeg-2.

I have installed FFDshow, which claims to be a directshow codec for mpg files. It did not solve my problem.


GfK(Posted 2008) [#6]
Um...... forget Codecs. That's not the problem.

You're drawing the screen, then clearing it with CLS before you FLIP buffers. Put the CLS after the FLIP and it'll work.


Ginger Tea(Posted 2008) [#7]
i just offered cocecs as ive way too many (non porn) movie clips that are just sound on my box yet not on others


zortzblatz(Posted 2008) [#8]
I put cls after flip and the end result was the same. To try to eliminate as many issues as possible I used the example code included in the blitz documentation for Directshow changing only the file it selects as the movie to my movie clip. It did the same thing as my code, played the sound but showed no images.


GfK(Posted 2008) [#9]
Well, whatever else you did, that needed fixing. As does this line:
x=(WIDTH-w)/2 y=(HEIGHT-h-100)/2

First, you've got two declarations in one line, so you must either separate them with a colon, or put them on separate lines. Also, I don't see where you've declared WIDTH and HEIGHT so I assume them both to be zero, which would probably mean your movie is being drawn off screen.

Try drawing the movie at a fixed screen position with fixed width and height before you worry about getting the position and scale right.

One other thing - to ensure maximum compatibility on other systems you need to encode your video with MPEG1.


zortzblatz(Posted 2008) [#10]
Thanks, HEIGHT and WIDTH being undefined made a big difference =P

THe code works fine now.


Zeotrope(Posted 2008) [#11]
Another happy customer...

Leave the money on the fridge on your way out!