Skip to content

Instantly share code, notes, and snippets.

@andrisgauracs
Created January 10, 2019 22:53
Show Gist options
  • Select an option

  • Save andrisgauracs/8af1be7b54c50abecede70b243df7b77 to your computer and use it in GitHub Desktop.

Select an option

Save andrisgauracs/8af1be7b54c50abecede70b243df7b77 to your computer and use it in GitHub Desktop.
def take_snapshot(self):
# Import the global variables we'll be using
global framesTaken, clusters, borderSize, offset
# This will be needed to check if the player was playing at the
# time of the button press
wasPlaying = None
# We need to get the width and height of the video file
videoSize = self.mediaplayer.video_get_size()
# This is the VLC function, that let's us
# take a snap shot of the video frame and save it in the directory
self.mediaplayer.video_take_snapshot(
0, "./img_"+str(framesTaken)+".png",
videoSize[0],
videoSize[1])
# While we do the image processing, let's pause the video
if self.mediaplayer.is_playing():
self.PlayPause()
wasPlaying = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment