From 5dcbca4aae494016669f459a48523d4bf8aac19b Mon Sep 17 00:00:00 2001 From: kris Date: Wed, 19 Jun 2019 21:54:07 +0100 Subject: [PATCH] Exit gracefully when running out of video frames --- transcoder/movie.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/transcoder/movie.py b/transcoder/movie.py index 427e9f3..e6af86b 100644 --- a/transcoder/movie.py +++ b/transcoder/movie.py @@ -53,7 +53,11 @@ class Movie: for au in self.audio.audio_stream(): self.ticks += 1 if self.video.tick(self.ticks): - main, aux = next(video_frames) + try: + main, aux = next(video_frames) + except StopIteration: + break + if ((self.video.frame_number - 1) % self.every_n_video_frames == 0): print("Starting frame %d" % self.video.frame_number)