[visionegg] Re: movies BUG

Hi Mikko,

OK, I fixed the bug and uploaded a new "Bleeding Edge" release to http://sourceforge.net/project/showfiles.php?group_id=40846&package_id=73479&release_id=138543

The cause was a silly mistake on my part -- not getting the movie bounding box correctly. I've fixed the problem and added safeguards to prevent it happening again. Unfortunately, these safeguards require a slight change to code that gets the movie bounds. After doing "bounds = movie.getMovieBox()", get the values by "width=bounds.right-bounds.left" (rather than the old, error-prone "width=bounds[3]-bounds[1]" ). The new quicktime.py demo file with these changes is attached.

Mikko Vähäsöyrinki wrote:

Hi Andrew,

Thanks for the information - it seems to work as you say. I think I'll just
get a better computer. However, I've encountered a bug that I don't know how
to fix. Part of the movie on the right side is clipped off and I couldn't
figure out why (seems to be something in the low level code). I've tried for
example "Why mac for science" movie from this website:

http://www.esm.psu.edu/Faculty/Gray/movies.html

It looks to me like one third of the movie is missing from the right when
shown with VisionEgg. Also the movie box is not really centered to the
screen even though it should (it's always at the lower part of the screen in
my system).

Cheers,
Mikko

-----Original Message-----
From: visionegg-bounce@xxxxxxxxxxxxx [mailto:visionegg-bounce@xxxxxxxxxxxxx]
On Behalf Of Andrew Straw
Sent: Tuesday, April 25, 2006 4:00 PM
To: visionegg@xxxxxxxxxxxxx
Subject: [visionegg] Re: movies

Hi Mikko,

The movies are played directly using the QuickTime API. I'm not sure what goes on "behind the scenes", but I imagine what's happening is 99% the same as what happens when you play something using the QuickTime Player. The primary difference is that the movie gets rendered to a block of memory, which the Vision Egg code then puts into an OpenGL texture.

So, the QuickTime API will try to make the movies play at whatever framerate is specified in the QuickTime file. If the Vision Egg draws more frames than that, there will simply be multiple identical frames drawn. So, if you want to accelerate the playback speed, I think you'd need to edit the QuickTime movie file.

You should be able to determine if your system is fast enough using the QuickTime player -- I hope the Vision Egg isn't too much less efficient that. If you can't play movies there without dropping frames, your computer is simply too slow. If you can play them there without dropping frames, but frames get dropped in the Vision Egg, we'll have to see if we can get some extra speed.

Cheers!
Andrew

Mikko Vähäsöyrinki wrote:



Many thanks for the movie support. I have it working in my system, but I'm
not getting high enough frame rates with my current (old) computer (I'm
limited to around 100 Hz). I was wondering if anyone has insight into the
hardware requirements for getting to the limits of my monitor (160Hz).


Another thing I've been wondering is how fast the movies recorded with my
standard camcoder are played in VisionEgg. Are they sped up to 160 Hz so
that my half an hour movie will only last a fraction of that when replayed?
I'm also a bit worried about how long movies I'll be able to play. I'm not
sure how the VisionEgg converts the quicktime movie files into
TextureStimulus. Are they read straight into memory, in which case the
memory would be the limiting factor? I would like to play up to an hour


long


movies with 160 Hz in VGA mode. Any thoughts of how this might work and


what


kind of computer I should buy to get it running?

All the help much appreciated.
Mikko Vahasoyrinki

-----Original Message-----
From: visionegg-bounce@xxxxxxxxxxxxx


[mailto:visionegg-bounce@xxxxxxxxxxxxx]


On Behalf Of Andrew Straw
Sent: Monday, April 03, 2006 1:11 AM
To: visionegg@xxxxxxxxxxxxx
Subject: [visionegg] Re: movies

Hi Mikko,

I just got QuickTime movies working in Windows. I made a "Bleeding Edge"
release for Windows users:
https://sourceforge.net/project/showfiles.php?group_id=40846&package_id=734


7


9
This is also in the subversion repository.

There is now an additional requirement, ctypes. (OK, there's also a
requirement to install QuickTime on your system, but you knew that...)

The old quicktime.py demo in the demos directory works unmodified on my
system.

I haven't tried my Mac with the new code and given the extent of the
changes, I'm convinced this will break Mac support for QuickTime movies
for the time being. However, this new code should be much more
maintainable in the long-term.

Cheers!
Andrew

Mikko Vähäsöyrinki wrote:





Hi All,

I would like to show some movies with the visionegg, but the demos
aren’t working and I’m not sure how to proceed. I’m running vision egg
in windows 2000. Trying to run the mpeg demo gives an error message of
missing module. Based on google it looks like the pygame.movie does
not come with the latest pygame and it’s not necessarily even
compatible with it. I also had a look at the quicktime option, but it
looks like it’s only for the mac at the moment.

All the help would be greatly appreciated.

Cheer,

Mikko

Dr. Mikko Vähäsöyrinki

California Institute of Technology

Division of Biology, MC 139-74

Pasadena, CA 91125

Tel. 626-395-2839





======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html


==================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html





====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html


====================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html



#!/usr/bin/env python
"""Display a quicktime movie in the Vision Egg.

See also mpeg.py, which plays MPEG movies.
"""

import os, sys
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import *
from VisionEgg.Text import *
from VisionEgg.Textures import *
from VisionEgg.QuickTime import new_movie_from_filename, MovieTexture
from pygame.locals import *

screen = get_default_screen()
screen.set(bgcolor=(0,0,0))

if len(sys.argv) > 1:
    filename = sys.argv[1]
else:
    filename = 
os.path.join(VisionEgg.config.VISIONEGG_SYSTEM_DIR,"data","water.mov")
movie = new_movie_from_filename(filename)
bounds = movie.GetMovieBox()
height = bounds.bottom-bounds.top
width = bounds.right-bounds.left

scale_x = screen.size[0]/float(width)
scale_y = screen.size[1]/float(height)
scale = min(scale_x,scale_y) # maintain aspect ratio

movie_texture = MovieTexture(movie=movie)

stimulus = TextureStimulus(
    texture=movie_texture,
    position = (screen.size[0]/2.0,screen.size[1]/2.0),
    anchor = 'center',
    mipmaps_enabled = False, # can't do mipmaps with QuickTime movies
    shrink_texture_ok = True,
    size = (width*scale, height*scale),
    )

text = Text( text = "Vision Egg QuickTime movie demo - Press any key to quit",
             position = (screen.size[0]/2,screen.size[1]),
             anchor = 'top',
             color = (1.0, 1.0, 1.0),
             )

viewport = Viewport(screen=screen,
                    stimuli=[stimulus, text])

movie.StartMovie()
frame_timer = FrameTimer()
quit_now = 0
while not quit_now:
    for event in pygame.event.get():
        if event.type in (QUIT,KEYDOWN,MOUSEBUTTONDOWN):
            quit_now = 1
    movie.MoviesTask(0)
    screen.clear()
    viewport.draw()

    swap_buffers() # display the frame we've drawn in back buffer
    frame_timer.tick()
    if movie.IsMovieDone():
        movie.GoToBeginningOfMovie()
        
frame_timer.print_histogram()

Other related posts: