Playing an AVI video [solved] - THANKS

Prob a really basic question but I can not make it work :[

myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject.setTexture(myMovieTexture)

I use that but once I go to run it closes panda.

I have also tried to use

movie.play()

with it but no video and panda closes all the time.

I was going off the tutorial found here

panda3d.org/manual/index.php … _AVI_files

What is the terminal output? I would be able to help much more if I knew what was going wrong… :wink:

also, make sure that “eve_rts/video/front_end.avi” is a valid path to the avi file, it may be that this path is missing?

~powerpup118

uuu terminal output? what do you mean by that?

and i use


from direct.gui.OnscreenImage import OnscreenImage

imageObject = OnscreenImage(image = 'eve_rts/imgs/testIMAGE.jpg', pos = (0, 0, 0))

which displays an image just fine the video is just in the video folder instead of the imgs folder so I would think the video path is correct.

The whole code that I would like to do is just this and this is all I have for the code (minus the image code) for my code file.


import direct.directbase.DirectStart

#Set the backgroun color
base.setBackgroundColor(0, 0, 0)


myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")

myObject.setTexture(myMovieTexture)

movie.play()

run()

[/code]

Normally you’d run a python file by either double clicking it (hides the terminal) or by going to a windows command prompt and finding the directory, and typing ‘ppython .py’

If you run it from the windows command prompt, it will tell you what you’re doing wrong, (to an extent anyway).

Anyway, if I had to guess it would be the following:

myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject.setTexture(myMovieTexture)
myMovieTexture.play()

I have no avi file laying around to test with, and no time to download one atm, see if you can run it from the terminal and get the output of the program :slight_smile:

EDIT: Also, is myObject actually a variable you have made? you do know this has to be a loaded model, right?
~powerpup118

oh, I’m using NetBeans and thats how I run the python file.

And no i have not made myObject a var and no I did not know that has to be loaded as a model…

So i’m missing that?

This is my whole code file



import direct.directbase.DirectStart

#Set the backgroun color
base.setBackgroundColor(0, 0, 0)



myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject.setTexture(myMovieTexture)

myMovieTexture.play()

run()

Netbeans has a little status bar at the bottom of the screen, I think it normally says ‘Running program…’ or something like that. It’s really important that you find the output of the program, it tells you why it’s crashed and is really really important for debugging things too, like the problem you’re having playing a movie :wink:

Here’s what I can say looks correct to me: (though without the output of your program I have no way of knowing for sure if it’s correct)

import direct.directbase.DirectStart

#Set the backgroun color
base.setBackgroundColor(0, 0, 0)



myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.reparentTo(render)
myObject.setTexture(myMovieTexture)

myMovieTexture.play()

run()

That looks proper to me, again though it’s really important to know the output of the program :wink:

ok,

it works now but the video does not play.

the output is this:

DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)

so it seems to work correctly just the video does not play and or start.

But panda 3d stays open!

Hehe thanks so far for the help!

Right, so here it is saying that in the file “eve_rts.py” on line 14, you tried to play the movie texture on myObject, only python has no idea what myObject is, you never declared it. :wink:

Try the code above where I declared myObject to the default panda3d smiley character, and you should (in theory) see the movie playing on the round sphere.

Otherwise hand over the outputs :smiley:,

~powerpup118

EDIT: alright, do you see a sphere on your screen though somewhere? you should see a black sphere somewhere at the least. You may have to move the camera around a bit (back it away from the object using hold-right-mouse-click + move the mouse towards your monitor)

yeah its just not playing so now i’m lost again but as above ur last post panda stays open and no errors soo now hmm.

oh ok i do see a sphere hehe ok wow but no video hehe it does have a smiley but no video!

and the video path is correct because I typed in front_end02.avi and it gives errors since it can not find front_end02.avi so I know its finding the video file just not displaying it on the smiely lol.

Hi, try this (downloaded an avi and tested for you :smiley:):

import direct.directbase.DirectStart

myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.setTexture(myMovieTexture, True)
myObject.reparentTo(render)

myMovieTexture.play()

run()

It’ll play the video on the sphere as you think.

~powerpup118

0o you got to put true in!! awesome thanks soo much!

Hehehe 1 more question if I wanted to say just play the movie not being displayed on the sphere would I need to create say a model such as a plane/box/cube?

And or Can I just have it play the video at the video resolution such as the video is 600x400 and panda is running in 800x600 just have the video play 600x not being on a sphere but just playing normally as you would see in any video player (like watching tv i guess you could say as video plays on a tv).

Thanks again soo much! hehe i’m getting closer to figuring out this panda!

That is one way to do it, especially if you wanted to make a 3d movie theater… you could make seats and everything and put the movie on the big screen :wink:

I’d go with making a plane model automatically inside panda3d, using CardMaker, this will work:

import direct.directbase.DirectStart
from pandac.PandaModules import CardMaker
from pandac.PandaModules import NodePath
from pandac.PandaModules import TextureStage

myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.setTexture(myMovieTexture, True)
myObject.reparentTo(render)

myMovieTexture.play()

cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(myMovieTexture)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTexture(myMovieTexture)
card.setTexScale(TextureStage.getDefault(), myMovieTexture.getTexScale())

run()

CardMaker basically makes a fullscreen plane object and then it puts the texture on it fullscreen, so yeah, it’ll work for what you want. :smiley:

~powerpup118

0o yay it runs! :stuck_out_tongue: thanks soo much! now i gotta figure out what all this code means that you posted here so I know what its doing hehe.

Thanks soo much I now need sleep!

:stuck_out_tongue:

That is one way to do it, especially if you wanted to make a 3d movie theater… you could make seats and everything and put the movie on the big screen :wink:

I’d go with making a plane model automatically inside panda3d, using CardMaker, this will work:

import direct.directbase.DirectStart
from pandac.PandaModules import CardMaker
from pandac.PandaModules import NodePath
from pandac.PandaModules import TextureStage

myMovieTexture=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.setTexture(myMovieTexture, True)
myObject.reparentTo(render)

myMovieTexture.play()

cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(myMovieTexture)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTexture(myMovieTexture)
card.setTexScale(TextureStage.getDefault(), myMovieTexture.getTexScale())

run()

CardMaker basically makes a fullscreen plane object and then it puts the texture on it fullscreen, so yeah, it’ll work for what you want. :smiley:

~powerpup118