def main(args): """ process each argument """ table = Texttable() table.set_cols_align(["r", "r", "r", "r", "r"]) rows = [["Number", "File Name", "File Size", "Video Duration (H:MM:SS)", "Conversion Time"]] total_time = 0.0 total_file_size = 0 for index, arg in enumerate(args, start=1): timer = utils.Timer() with timer: result = resize(arg, (index, len(args))) # result.elapsed_time = timer.elapsed_time() rows.append([index, result.file_name, utils.sizeof_fmt(result.file_size), utils.sec_to_hh_mm_ss(utils.get_video_length(result.file_name)) if result.file_name else "--", "{0:.1f} sec.".format(result.elapsed_time) if result.status else FAILED]) # if rows[-1][-1] != FAILED: total_time += result.elapsed_time total_file_size += result.file_size table.add_rows(rows) print table.draw() print 'Total file size:', utils.sizeof_fmt(total_file_size) print 'Total time: {0} (H:MM:SS)'.format(utils.sec_to_hh_mm_ss(total_time)) print utils.get_unix_date()
def frame(fname, size_tuple): index, full_size = size_tuple t = utils.sec_to_hh_mm_ss(utils.get_video_length(fname)) s = "({index} of {full_size}) {fname} ({time})".format( index=index, full_size=full_size, fname=fname, time=t ) size = len(s) horizontal = '+' + '-' * (size+2) + '+' print termcolor.colored(horizontal, "green") print termcolor.colored('| ' + s + ' |', "green") print termcolor.colored(horizontal, "green")
for row in f: class_names.append(row[:-1]) ffmpeg_loglevel = 'quiet' if opt.verbose: ffmpeg_loglevel = 'info' if os.path.exists('tmp'): subprocess.call('rm -rf tmp', shell=True) outputs = [] for input_file in input_files: video_path = os.path.join(opt.video_root, input_file) if os.path.exists(video_path): if get_video_length(video_path) > 400: print("SKIPPING LONG VDO -->>>>>") continue # print(video_path) # subprocess.call('mkdir tmp', shell=True) # subprocess.call('ffmpeg -i {} -ss 00:00:01 -t 00:04:01 -vf scale=240:320 -r 30 tmp/image_%05d.jpg -loglevel quiet -stats'.format(video_path), # shell=True) else: print(video_path) subprocess.call('mkdir tmp', shell=True) subprocess.call( 'ffmpeg -i {} -vf scale=240:320 -r 30 tmp/image_%05d.jpg -loglevel quiet -stats' .format(video_path),