fixed bug where iterator never stopped looping through video frame data in python 3

This commit is contained in:
Frank DeMarco 2019-10-21 00:46:10 -04:00
parent 869fed171d
commit 1910fa567a
1 changed files with 8 additions and 8 deletions

View File

@ -75,14 +75,6 @@ class VideoRecorder(GameChild):
root = join(self.root, strftime(self.directory_name_format))
if not exists(root):
makedirs(root)
size = self.display_surface.get_size()
frames = self.frames
frames.seek(0)
for ii, frame in enumerate(iter(lambda: frames.read(self.frame_length),
"")):
path = join(root, "%04i.png" % ii)
save(frombuffer(frame, size, self.frame_format), path)
print("wrote video frames to " + root)
if self.check_command_line("-enable-sound-recording"):
import pyaudio
import wave
@ -95,6 +87,14 @@ class VideoRecorder(GameChild):
wf.setframerate(44100)
wf.writeframes(b"".join(self.audio_frames))
wf.close()
size = self.display_surface.get_size()
frames = self.frames
frames.seek(0)
for ii, frame in enumerate(
iter(lambda: frames.read(self.frame_length), b'')):
path = join(root, "%04i.png" % ii)
save(frombuffer(frame, size, self.frame_format), path)
print("wrote video frames to " + root)
def update(self):
ticks = get_ticks()