@@ -39,8 +39,9 @@ class SceneFileWriter(object):
39
39
The file-type extension of the outputted video.
40
40
"""
41
41
42
- def __init__ (self , scene , ** kwargs ):
42
+ def __init__ (self , video_quality_config , scene , ** kwargs ):
43
43
digest_config (self , kwargs )
44
+ self .video_quality_config = video_quality_config
44
45
self .scene = scene
45
46
self .stream_lock = False
46
47
self .init_output_directories ()
@@ -167,8 +168,8 @@ def get_resolution_directory(self):
167
168
:class:`str`
168
169
The name of the directory.
169
170
"""
170
- pixel_height = self .scene . camera . pixel_height
171
- frame_rate = self .scene . camera . frame_rate
171
+ pixel_height = self .video_quality_config [ " pixel_height" ]
172
+ frame_rate = self .video_quality_config [ " frame_rate" ]
172
173
return "{}p{}" .format (pixel_height , frame_rate )
173
174
174
175
# Directory getters
@@ -369,7 +370,7 @@ def idle_stream(self):
369
370
self .add_frame (* [frame ] * n_frames )
370
371
b = datetime .datetime .now ()
371
372
time_diff = (b - a ).total_seconds ()
372
- frame_duration = 1 / self .scene . camera . frame_rate
373
+ frame_duration = 1 / self .video_quality_config [ " frame_rate" ]
373
374
if time_diff < frame_duration :
374
375
sleep (frame_duration - time_diff )
375
376
@@ -389,9 +390,6 @@ def finish(self):
389
390
self .flush_cache_directory ()
390
391
else :
391
392
self .clean_cache ()
392
- if file_writer_config ["save_last_frame" ]:
393
- self .scene .update_frame (ignore_skipping = True )
394
- self .save_final_image (self .scene .camera .get_image ())
395
393
396
394
def open_movie_pipe (self ):
397
395
"""
@@ -408,9 +406,9 @@ def open_movie_pipe(self):
408
406
self .partial_movie_file_path = file_path
409
407
self .temp_partial_movie_file_path = temp_file_path
410
408
411
- fps = self .scene . camera . frame_rate
412
- height = self .scene . camera . pixel_height
413
- width = self .scene . camera . pixel_width
409
+ fps = self .video_quality_config [ " frame_rate" ]
410
+ height = self .video_quality_config [ " pixel_height" ]
411
+ width = self .video_quality_config [ " pixel_width" ]
414
412
415
413
command = [
416
414
FFMPEG_BIN ,
0 commit comments