def convert_frames_to_video(tar_file_path, output_path="<STR_LIT>", framerate=<NUM_LIT>, overwrite=False):
output_path = os.path.abspath(output_path)<EOL>if os.path.isfile(output_path) and not overwrite:<EOL><INDENT>raise ValueError("<STR_LIT>".format(output_path))<EOL><DEDENT>with tempfile.TemporaryDirectory() as tmp_dir:<EOL><INDENT>with tarfile.open(tar_file_path) as tar:<EOL><INDENT>tar.extractall(tmp_dir)<EOL><DEDENT>args = ["<STR_LIT>",<EOL>"<STR_LIT>", str(framerate),<EOL>"<STR_LIT>", r"<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>"]<EOL>if overwrite:<EOL><INDENT>args.append("<STR_LIT>")<EOL><DEDENT>args.append(output_path)<EOL>try:<EOL><INDENT>subprocess.check_call(args, cwd=tmp_dir)<EOL><DEDENT>except subprocess.CalledProcessError as e:<EOL><INDENT>print("""<STR_LIT>""")<EOL>raise<EOL><DEDENT><DEDENT>print("<STR_LIT>".format(output_path))<EOL>return output_path<EOL>
Try to convert a tar file containing a sequence of frames saved by the
meshcat viewer into a single video file.

This relies on having `ffmpeg` installed on your system.