I am trying to take a screenshot of every frame of a movie for other processing. However, when I run this, all I get is newlines printed out. After I kill the program in any way, I get a Segmentation fault (core dumped)
Why is the segmentation fault happening? My code or pygame or somthing else?
Why do I not get some text out of the program?
Using Python 2.7, Ubuntu
import sys
import os
if sys.platform == 'win32' and sys.getwindowsversion()[0] >= 5:
os.environ['SDL_VIDEODRIVER'] = 'windib'
import pygame
pygame.init()
pygame.mixer.quit()
movie = pygame.movie.Movie(sys.argv[1])
screen = pygame.display.set_mode(movie.get_size())
movie.set_display(screen)
movie.play()
while movie.get_busy():
print pygame.image.tostring(screen, 'RGB', False)
if pygame.event.peek(pygame.QUIT):
pygame.quit()
exit()
pygame.event.clear()
movie.stop()
pygame.quit()
This is my first question so please say if I have missed anything :)