Alex Holkner schreef:
>> Unfortunately I don't have time yet to play around with pyglets, but
>> it seems very interesting. I might give it a try later. I am looking
>> for a library which can extract the frames of a movie as PIL images on
>> the fly with without storing them on disk and preferably with random
>> access. Is such thing possible with pyglet?
>
> Yes, something like:
>
> from pyglet import window
> from pyglet import media
> import Image
>
> w = window.Window(visible=False) # only needed to create GL context
>
> source = media.load('movie.avi')
> player = media.Player()
> player.queue(source)
> player.play()
> while player.source:
> player.dispatch_events()
> img = player.texture.image_data
> pilimg = Image.fromstring(img.format, (img.width, img.height),
> img.data)
> # optional: player.seek(time)
>
> A faster solution that doesn't bother with the round-trip to the
> video card could be achieved by subclassing
> pyglet.media.avbin.AVbinSource.
>
> Alex.
I've tried it on Ubuntu and it works well. I have two questions:
1. The script above saves the frame based on how much time has passed.
Is it also possible to access the frames of a movie one by one
independent of time? So that I can access precisely frame[0], frame[1],
..., frame[n] independent of the framerate?
2. For me the speed is the most important. What is generally faster: the
roundtrip through the videocard or pyglet.media.avbin.AVbinSource?
Stani
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---