mirror of
https://github.com/correl/turntable.git
synced 2024-11-23 11:09:56 +00:00
DO NOT MERGE: BMP video capture
Capture the last two seconds of video to bmp files
This commit is contained in:
parent
10b95738e8
commit
21fd4cf75e
1 changed files with 10 additions and 0 deletions
|
@ -174,6 +174,7 @@ def main():
|
|||
app.run()
|
||||
clock = pygame.time.Clock()
|
||||
title = "<Idle>"
|
||||
frames = deque(maxlen=60 * 2)
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
if event.type == QUIT or (
|
||||
|
@ -182,6 +183,14 @@ def main():
|
|||
app.shutdown()
|
||||
pygame.quit()
|
||||
return
|
||||
if event.type == KEYDOWN and event.key == K_v:
|
||||
for frame, s in enumerate(frames):
|
||||
pygame.image.save(
|
||||
pygame.image.fromstring(
|
||||
s, (screen.get_width(), screen.get_height()), "RGB"
|
||||
),
|
||||
"turntable-{:04d}.bmp".format(frame),
|
||||
)
|
||||
try:
|
||||
while event := event_queue.get(False):
|
||||
...
|
||||
|
@ -208,6 +217,7 @@ def main():
|
|||
title_rect.centery = screen.get_height() - 25
|
||||
screen.blit(title_text, title_rect)
|
||||
pygame.display.update()
|
||||
frames.append(pygame.image.tostring(screen, "RGB"))
|
||||
clock.tick(FPS)
|
||||
except:
|
||||
logger.exception("Shutting down")
|
||||
|
|
Loading…
Reference in a new issue