Hi John,

This is a feature that I know Alex is working on including in avbin.  
Presumably, pyglet will be updated to support it as and when it gets  
into the avbin tree.

In the meanwhile, you could look into the internals of  
pyglet.media.avbin and sub-class the pyglet.media.avbin.AVbinSource to  
figure out the frame rate. You could do this by calling the  
combination of self.get_next_video_frame() and  
self._last_video_timestamp() a few times. Examining the mean  
difference between the timestamps of the first few adjacent frames  
will tell you the FPS. But don't forget to call self._seek(0) when  
you're done to reset the video position.

Padraig

On 5 May 2009, at 13:58, John Hall wrote:

>
> I load a video file with:
>
> source = pyglet.media.load(sys.argv[1])
> format = source.video_format
>
> and look at the format.
>
> source.duration gives me the playing time in seconds.
> format give me some other useful info, but I can't find the frame
> rate.
>
> My app would like to know at the start the number of frames it will
> get via looping
> nextframe = source.get_next_video_frame() ,
> because I need to create a (still) image in which one dimension is
> related to the number of video frames.
>
> Currently I have to hard-wire frames-per-second into the program, or
> ask the user to specify that.
> I could do a first pass to determine this, but that's un-aesthetic.
> Or make the image too large and crop off the unused part at the end.
>
> Is there a way to get frames-per-second or number-of-frames directly
> from the source?
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to