forcing entire video image to blit

22 views
Skip to first unread message

Blaine Booher

unread,
Dec 18, 2012, 2:14:08 PM12/18/12
to pyglet...@googlegroups.com
hi guys,

my solution to my previously mentioned memory leak is to only use specific codecs that AVBin0 apparently doesn't bug out on. By doing this I can use EOS_LOOP on the video and it restarts just fine. 

My question is - once I restart the video, it doesn't refresh all of the image, leaving it a bit choppy until there is a drastic change in the video to cause a full refresh of the sprite. Is there an easy way to force a full image blit? Or maybe clear out the sprite when I restart the video with a black box or similar?

Here is how I'm drawing the frames now. thanks!
def on_draw(self):
            if self.sprite is None:
                self.sprite = Sprite(self.player.get_texture()) # maybe we could flush the sprite with all black but this still wouldn't force the image to be a full video frame
                win_width, win_height = director.get_window_size()
                self.sprite.position = (win_width / 2., win_height / 2.)
                self.sprite.scale = (win_width / self.sprite.width)
            else:
                self.sprite.image = self.player.get_texture() # it would be nice if i could somehow force this to grab the entire frame, rather than the recently changed pixels
            self.sprite.draw()

any ideas?

Blaine Booher

unread,
Dec 21, 2012, 12:16:52 PM12/21/12
to pyglet...@googlegroups.com
Still haven't found a good solution to this =\

Nathan

unread,
Apr 25, 2013, 6:08:49 PM4/25/13
to pyglet...@googlegroups.com
Sorry for the slow response, Blaine.

The short answer to your question is that there is no quick and easy way to do what you want, but it can be done in theory.

The longer answer is that most modern videos are encoded with occasional key frames (a complete picture, like an image file) and then the frames in between the key frames describe what _changes_ from the previous frame. So when you jump to a frame you have these options:

- only jump to key frames, and always have a full picture to start with.

- jump to any frame and start playing it, resulting in "blocky" odd-looking video until you hit the next key frame.

- find the key frame previous to the intermediate frame you happened to pick, and quickly decode from the key frame to the frame you want to start with without playing the video out.

~ Nathan


--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pyglet-users/-/L8ZIGyXk5I4J.

To post to this group, send email to pyglet...@googlegroups.com.
To unsubscribe from this group, send email to pyglet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.

Reply all
Reply to author
Forward
0 new messages