do not allow writing movie if no frames written

This commit is contained in:
Johannes Stelzer 2023-01-13 17:25:21 +01:00
parent baaa6ef18a
commit b45fda88b7
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,4 @@
# Copyright 2022 Lunar Ring. All rights reserved.
# Written by Johannes Stelzer, email stelzer@lunar-ring.ai twitter @j_stelzer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -149,6 +148,9 @@ class MovieSaver():
r"""
Call this function to finalize the movie. If you forget to call it your movie will be garbage.
"""
if self.nmb_frames == 0:
print("You did not write any frames yet! nmb_frames = 0. Cannot save.")
return
self.ffmpg_process.stdin.close()
self.ffmpg_process.wait()
duration = int(self.nmb_frames / self.fps)