read avi file err

self.myMovieTexture=MovieTexture(“myavi”)
assert self.myMovieTexture.read(avipath), “Failed to load video!”

in panda171,it is ok

in oanda180, self.myMovieTexture.read(avipath) got some err

Thank you for the report! Do you have a link to the failed avi file so I can try it out too?

Thanks!
David

sourceforge.net/projects/es3dinpanda/files/AVI/

What operating system are you using? What is the error message? Does it play in spite of the error message, or does it fail to play completely? When did you download Panda3D 1.8.0?

Thanks.
David

operating system: win7
error message: self.card.setTexScale(TextureStage.getDefault(), self.myMovieTexture.getTexScale())
AssertionError: !scale.is_nan() at line 545 of e:\panda180\panda3d\panda\src\pgraph\transformState.cxx

Panda3D 1.8.0: down from cvs ,2011/11/28

mycode:
#coding=utf-8
from panda3d.core import *
loadPrcFileData("", “audio-library-name p3openal_audio”)
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
import sys
sys.path.append("…")
class aviManager(DirectObject):
def init(self,avipath):
#self.myMovieTexture=loader.loadTexture(avipath)
self.myMovieTexture=MovieTexture(“myavi”)
#assert self.myMovieTexture.read(avipath), “Failed to load video!”
self.myMovieTexture.read(avipath)

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

    self.accept('escape', self.close)
    self.bover=False
    self.iavitime=self.myMovieTexture.getVideoLength()-1.1
def play(self):
    self.myMovieTexture.play()
def onTimer(self,dt):

     if(self.bover):
         return False
     if (not self.myMovieTexture.isPlaying()):
         self.close()
     
     if(self.myMovieTexture.getTime()>=self.iavitime):
        
         self.close()
     return True
         
def stopsound(self):
    self.sound.stop()
    self.sound.setPlayRate(1.0)
def close(self):
    self.card.detachNode()
    self.card.removeNode()
    self.bover=True
    print "avi over"

main.py:

from pandac.PandaModules import MultiplexStream,Notify,Filename
import sys,os

filename=sys.path[0]+"/script.log"
if os.path.isfile(filename):
os.remove(filename)
nout = MultiplexStream()
Notify.ptr().setOstreamPtr(nout, 0)
nout.addFile(Filename(filename))

myfile = open(filename, ‘a’)
sys.stdout = myfile
sys.stderr = myfile

import direct.directbase.DirectStart

from panda3d.core import NodePath,TextNode
from panda3d.core import Vec3,Vec4
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from direct.interval.SoundInterval import SoundInterval
from direct.gui.DirectSlider import DirectSlider
from direct.gui.DirectButton import DirectButton
from direct.interval.MetaInterval import Sequence,Parallel
from direct.interval.LerpInterval import LerpFunc

from aviManager import aviManager

class World(DirectObject):
def init(self):

self.gameTask = taskMgr.add(self.gameLoop, "gameLoop")
self.gameTask.last = 0         #Task time of the last frame
self.gameTask.nextBullet = 0   #Task time when the next bullet may be fired
    
self.avi=aviManager("music/begin.avi")

def gameLoop(self, task):
dt = task.time - task.last
self.avi.onTimer(dt)
task.last = task.time

and we can run!

w = World()
run()

sourceforge.net/projects/es3dinpanda/files/

avi.zip

I can’t reproduce the !scale.is_nan() error, so I don’t know how that happened. There was a temporary bug in a much older build of 1.8.0 that would have allowed that error, but it has been fixed for a long time.

However, I did find a bug in MovieTexture.getTime() that was returning the wrong value, which was causing your program to terminate the movie early. I’ve committed this fix, and it should be available in the next buildbot release.

David

self.myMovieTexture.read(avipath) return false

/1、/
// Just an ordinary read of one file.
if (!do_read_one(cdata, fullpath, alpha_fullpath, z, n,
primary_file_num_channels, alpha_file_channel,
options, header_only, record)) {
nout<<“Texture::do_read error 7 \r\n”;
return false;
/
/

/2、/
color = MovieVideo::get(fullpath)->open();
if (color == 0) {
nout<<“MovieTexture::do_read error 2 \r\n”;
return false;
}
/
/

/3、*******/

PT(MovieVideo) MovieVideo::
get(const Filename &name) {
#ifdef HAVE_FFMPEG
// Someday, I’ll probably put a dispatcher here.
// But for now, just hardwire it to go to FFMPEG.
return new FfmpegVideo(name);
#else
return new MovieVideo(“Load-Failure Stub”);
#endif
}
/*******/

/4、/
PT(MovieVideoCursor) MovieVideo::
open() {
nout<<“MovieVideo::open error 1 \r\n”;
return NULL;
}
/
/

MovieVideo::open error 1
MovieTexture::do_read error 2
Texture::do_read error 7
Assertion failed: !scale.is_nan() at line 545 of e:\panda180\panda3d\panda\src\pgraph\transformState.cxx

Well, are you sure the filename is correct?

David

the filename is correct

I use panda170 to run the demo ,it is ok

Oh, wait. You’re seeing “MovieVideo::open error 1”? This means that you didn’t build Panda with ffmpeg support. (HAVE_FFMPEG wasn’t defined.)

Did you build your own Panda? Did you provide a working ffmpeg library? It doesn’t seem that makepanda located ffmpeg. When you run makepanda, look for a message like this at the start:

WARNING: Could not locate thirdparty package ffmpeg, excluding from build

David

Thanks!
I download ffmpeg library,and it is ok now.

Is there a download link to all the thirdparty?

This is available on the 1.7.2 SDK download page. There’s not yet one provided for the 1.8.0 build, though, but the 1.7.2 version should be close enough.

David