ai2thor icon indicating copy to clipboard operation
ai2thor copied to clipboard

How to generate a video

Open laopao2002 opened this issue 4 years ago • 3 comments

Hi,

I find that there is no document or tutorial which shows how to generate a video. I can get the frames after each event and then merge to a video, but it's choppy. Or I can use a screen recording software to record a video from the renderer, but the actions (such as move ahead, rotate and pick up something etc) perform suddenly.

Is there another way to generate a video? I find a file called "video controller.py", but when I run the following code, some errors occur:

from ai2thor.controller import VideoController with VideoController() as vc: vc.play(vc.MoveAhead()) vc.wait(5) vc.play(vc.MoveAhead()) vc.exportVideo('thor.mp4')

And if I want to get a smooth video, what should I do?

Thank you!

laopao2002 avatar Oct 12 '20 16:10 laopao2002

Hey, what error did you get from running the code?

mattdeitke avatar Oct 12 '20 20:10 mattdeitke

Hey, the error was:

in ----> 1 with VideoController() as vc: 2 vc.play(vc.MoveAhead()) 3 vc.wait(5) 4 vc.play(vc.MoveAhead()) 5 vc.exportVideo('thor.mp4')

in init(self, cam_rot, cam_pos, cam_fov, **controller_kwargs) 13 cam_fov=60, 14 **controller_kwargs): ---> 15 super().init(continuous=True, **controller_kwargs) 16 self.step( 17 action='AddThirdPartyCamera',

~/anaconda3/lib/python3.8/site-packages/ai2thor/controller.py in init(self, quality, fullscreen, headless, port, start_unity, local_executable_path, width, height, x_display, host, scene, image_dir, save_image_per_frame, docker_enabled, depth_format, add_depth_noise, download_only, include_private_scenes, server_class, **unity_initialization_parameters) 445 ) 446 --> 447 event = self.reset(scene) 448 if event.metadata['lastActionSuccess']: 449 init_return = event.metadata['actionReturn']

in reset(self, scene) 31 self.step( 32 action='AddThirdPartyCamera', ---> 33 rotation=self.initial_cam_rot, 34 position=self.initial_cam_pos, 35 fieldOfView=self.initial_cam_fov)

AttributeError: 'VideoController' object has no attribute 'initial_cam_rot'

laopao2002 avatar Oct 12 '20 21:10 laopao2002

Same error. @laopao2002 and @mattdeitke PR https://github.com/allenai/ai2thor/pull/856 fixes this bug

d-val avatar Aug 05 '21 18:08 d-val