def _reset(self, **kwargs):
        '''
        Overwrites reset method. in addition to reseting the environment,
        this method also manages the video process and when to start writing video
        or gif to file
        '''
        self.num_steps = 0

        if self.is_recording:
            self.stop_record()

        if self.num_eps % self.capture_interval == 0:
            self.video_queue = Queue()
            self.is_recording = True

            path = os.path.join(self.save_folder, 'video_eps_{}{}'.format(self.num_eps, self.ext))
            if self.num_paths >= self.max_videos:
                dep_path = self.path_queue.get()
                os.remove(dep_path)
                self.num_paths -= 1

            self.path_queue.put(path)
            self.video_process = Process(target=save_video,
                                         args=(self.video_queue, path, self.fps))
            self.video_process.start()
            self.num_paths += 1

        state = self.env.reset(**kwargs)
        self.num_eps += 1
        return state

        Overwrites reset method. in addition to reseting the environment,
        this method also manages the video process and when to start writing video
        or gif to file
        
surreal/env/video_env.py