help with playing avi files

I want to play an avi file. I created an egg file and tried setting its texture as the avi file. It just doesnt work. Can you please help me? The code is as follows:

myObject = loader.loadModel(“menu”)
myMovieTexture=loader.loadTexture(“Final Credits-0001.avi”)

Here, menu is an egg file that I created from a blank yellow jpeg

I played around with this 2 days ago. This is the code that I came up with:

#create object
cm = CardMaker('Movie')
movieCard = render2d.attachNewNode(cm.generate())

#set movie texture

Using the CardMaker I create a square that fills the screen. Otherwise your code looks a lot like mine. Do you get an error on the commandline? Perhaps the correct codec for the video was not found?

Thank You:) I tried that too. It doesnt work though.
I get this error:

TypeError: NodePath::set_texture() argument must be Texture, not None Type.

Do you have any idea how to get around this problem? I guess its a problem with the codec. I created a wmv file using Movie maker and converted this to an avi file using BlazePro. Do you have any suggestions?

Thank You

well ,avi files can use different codecs. (i dont know blazepro…but )perhaps blazepro allows you to choose the codec you want to use, perhaps changeing it will help.
try to figure out which codec blazepro uses.

perhaps using virtualdub or mencoder can create a file with supported codec if you cant get it to work with blazepro.

have you already checked if your code works with a “proven-to-work-texture”?

I have been experimenting a bit using the above code. After trying 5 different .avi files, I keep getting the following trace (with ‘info’ level messages):

:grutil(error): OpenCV couldn't read /c/dev/Djerlani/textures/test2.avi as video.
:gobj(error): Texture "/c/dev/Djerlani/textures/test2.avi" exists but cannot be read.
Traceback (most recent call last):
  File "C:\dev\Djerlani\", line 4, in ?
    import Myw
  File "C:\dev\Djerlani\", line 35, in ?
TypeError: NodePath::set_texture() argument 1 must be Texture, not NoneType
:display: Closing wglGraphicsWindow

Isn’t it:
otherwise the Priority argument will be zero.
(i’m just a noob so sorry if i’m completely wrong)

Well, the point is not so much that the setTexture method does not work, (setting a priority is optional), but that the loadTexture comes back with a NoneType.

The error ‘:gobj(error): Texture “/c/dev/Djerlani/textures/test2.avi” exists but cannot be read.’ implies that there is something wrong with the file or the codec.

The problem at this point is to find out what exactly and fix it :slight_smile:

Are you running Windows or Linux?

that would be windows

I used an mpg movie you can download here: … it&lid=113

It was just the first square movie file google pointed me too :slight_smile: . This one works for me, although it seems the “quality of the decoding” is not very good, e.g. a lot of blocks from a previous mpeg frame remaining visible in the next. If anyone has good experiences with a certain codec, I’d love to learn which one!

When using the above file with either laurens’ or electrons’ method, I still get an error:

I have no trouble playing it in bsplayer, vlc or windows media player on this computer. No such luck with panda though :confused:

You appear to be using an older version of Panda, which used OpenCV for video texture support. The most recent version of Panda uses the ffmpeg library for video texture instead, and this library is much better able to load a variety of different video formats.