What kind of movie file could be played in B3D?

Blitz3D Forums/Blitz3D Beginners Area/What kind of movie file could be played in B3D?

Happy Sammy(Posted 2006) [#1]
Hi all,

What kind of movie file could be played in B3D?
Do we need any 3rd-party tools or wrapper?

Thanks in advance
Sammy
:)


Matty(Posted 2006) [#2]
Well I know that .avi movies play fine in B3d, and while not entirely sure I think that any movie that you have the codec installed will play in b3d.


jfk EO-11110(Posted 2006) [#3]
That's correct. The codec must be installed. Unfortunately Micorsoft published its recent OSes with a codec set that differs with every version, so basicly you'll never be sure if all users have a certain codec installed (thought CInepak radius is on all windows versions, but then it turned out it's not)
My advice is, use a good codec that may be distributed freely, then add the codec installer to your game release. You may mention in the help docs if the codec is missing then they may install the one provided with the game.

A more advanced method would be to open the moviefile, check the returned handle and if it's zero (failed to open the movie) then run the codec installer.

Please note "Avi" is no specific codec, but an undefined container. So a system may support some avis and some not.

BTW: Blitz has its built in simple Movie command set, check out the manual / Command Reference! (DirectShow).


IPete2(Posted 2006) [#4]
Sammie,

Have a look at this and try it out...

in blitz 3d


graphics3d,800,600

Global movie1
Global file1$="nameofyourmovie.avi"
movie1=OpenMovie( file1$ )
If movie1=0 RuntimeError "Unable to open movie file"



while not keydown(1)

UpdateWorld
RenderWorld

If  (KeyDown(203)) And (Not MoviePlaying (movie1) ) Then movie1=OpenMovie( file1$ )

If (MoviePlaying(movie1)) Then DrawMovie movie1,36,26,175,150

Flip False

Wend
CloseMovie movie

End



************

Press the left arrow key to play the movie.


Hope that helps.

IPete2.


Happy Sammy(Posted 2006) [#5]
Thanks you, all of you.
That means we could play any movie format,
on condition that, we install the correct codec.

@IPETE2: I tried to play "c:\windows\clock.avi"
There is no need to press any key and start automatically.
The clock counts from 1 to 12.
When it counts from 11 to 12, it keeps flashing between
11 and 12 until I press ESC.
What's wrong with the movie?

Thanks in advance
Sammy
:)


IKG(Posted 2006) [#6]
BTW: Blitz has its built in simple Movie command set, check out the manual / Command Reference! (DirectShow).


Please explain more. Is it that easy to play a .avi?


puki(Posted 2006) [#7]
"Sammy" do you have a CRT or an LCD monitor?


Happy Sammy(Posted 2006) [#8]
Hi puki,

I have both.
But I tested it on LCD of my laptop.

Sammy
:)


IKG(Posted 2006) [#9]
Wait, how can you play an .avi?


jfk EO-11110(Posted 2006) [#10]
Please read the fantastic manual (help-command reference-2D-DirectShow). And try the example IPete posted in this thread.


IKG(Posted 2006) [#11]
Whoops. Was looking for the command called "DirectShow"; not the section. Got it.


Happy Sammy(Posted 2006) [#12]
Hi IPete2,

I try to replace with other movie files.
I still get the same result.
(The movie keeps flashing between the last two frames)
What things do I need to change?

Thanks in advance.
Sammy
:)


jfk EO-11110(Posted 2006) [#13]
maybe try this:

graphics3d,800,600
Global movie1
Global file1$="nameofyourmovie.avi"

movie1=OpenMovie( file1$ )
If movie1=0 RuntimeError "Unable to open movie file"

while not keydown(1)
 If (MoviePlaying(movie1)=0) Then 
  CloseMovie( movie1 )
  movie1=OpenMovie( file1$ )
 endif
 DrawMovie movie1,36,26,175,150
 Flip False
Wend

CloseMovie movie
End



Happy Sammy(Posted 2006) [#14]
Hi jfk,

I tried as above with "c:\windows\clock.avi"
Normal frame seq.: 1,2,3,...,11,12
When I run the program, the seq.:1,2,3,...,11,1,2,3,...,11,..
frame 12 (last frame) was skipped and repeat until pressing ESC

(1) Why the last frame was skipped?
(2) If I just want to play once, what should I do?
(I search the help manual, there is no such "end of movie file" command for checking.)

Thanks in advance.
Sammy
:)


FreetimeCoder(Posted 2006) [#15]
There is a "end of movie file"-command:
--> If MoviePlaying(movie)=0
returns True if the movie ends or no movie is playing.

If you want to play a movie once try this:
Graphics 640,480
SetBuffer Backbuffer()

If movie=0
movie=OpenMovie("Sample.avi")
Endif

While Not Keyhit(1)
DrawMovie movie,0,0,640,480
If MoviePlaying(movie)=0
End
Endif
Flip
Wend
End



Happy Sammy(Posted 2006) [#16]
Hi all,

Thanks a lot for your coding.

To play the movie once with no skipping frame...
Graphics3D 800,600

Global movie1
Global file1$="c:\windows\clock.avi"
movie1=OpenMovie( file1$ )
If movie1=0 RuntimeError "Unable to open movie file"

While Not KeyDown(1)

	DrawMovie movie1,36,26,175,150
	If  MoviePlaying (movie1)=0 Then 
            ;----- if you want to play once only
		End
            ;----- if you want to play continuously, uncomment the following
            ;CloseMovie movie1
            ;movie1=OpenMovie( file1$ )
	EndIf

	Flip False

Wend
CloseMovie movie1

End

(It seems that "graphics3d" must be used in playing movies)

Thanks
Sammy
:)


jhocking(Posted 2006) [#17]
Note that compressed movies play much slower than uncompressed, so much so that, depending on other factors, the playback may be stuttery. An uncompressed movie takes up much more harddrive space of course, but then if you're playing movie files I assume this isn't some tiny download-only game anyway.