def run(self, args):
'''
Load the images from a tub and create a movie from them.
Movie
'''
import moviepy.editor as mpy
args, parser = self.parse_args(args)
if args.tub is None:
parser.print_help()
return
conf = os.path.expanduser(args.config)
if not os.path.exists(conf):
print("No config file at location: %s. Add --config to specify\
location or run from dir containing config.py." % conf)
return
try:
cfg = dk.load_config(conf)
except:
print("Exception while loading config from", conf)
return
self.tub = Tub(args.tub)
self.num_rec = self.tub.get_num_records()
self.iRec = 0
print('making movie', args.out, 'from', self.num_rec, 'images')
clip = mpy.VideoClip(self.make_frame, duration=(self.num_rec//cfg.DRIVE_LOOP_HZ) - 1)
clip.write_videofile(args.out,fps=cfg.DRIVE_LOOP_HZ)
print('done')
评论列表
文章目录