diff --git a/gnes/preprocessor/io_utils/video.py b/gnes/preprocessor/io_utils/video.py index 02d9f89f..7ace4b6a 100644 --- a/gnes/preprocessor/io_utils/video.py +++ b/gnes/preprocessor/io_utils/video.py @@ -129,6 +129,11 @@ def encode_video(images: 'np.ndarray', err = '\n'.join([' '.join(cmd_args), err.decode('utf8')]) raise IOError(err) + if proc.stdout is not None: + proc.stdout.close() + if proc.stderr is not None: + proc.stderr.close() + return output diff --git a/gnes/preprocessor/video/shotdetect.py b/gnes/preprocessor/video/shotdetect.py index e076c8fd..9ab26954 100644 --- a/gnes/preprocessor/video/shotdetect.py +++ b/gnes/preprocessor/video/shotdetect.py @@ -67,7 +67,7 @@ def detect_shots(self, frames: 'np.ndarray') -> List[List['np.ndarray']]: shots = [] for ci in range(0, len(shot_bounds) - 1): - shots.append(frames[shot_bounds[ci]:shot_bounds[ci + 1]]) + shots.append(frames[shot_bounds[ci]:shot_bounds[ci + 1]].copy()) return shots @@ -87,7 +87,7 @@ def apply(self, doc: 'gnes_pb2.Document') -> None: elif raw_type == gnes_pb2.NdArray: video_frames = blob2array(doc.raw_video) if self.vframes > 0: - video_frames = video_frames[0:self.vframes, :] + video_frames = video_frames[0:self.vframes, :].copy() num_frames = len(video_frames) if num_frames > 0: