Skip to content
Snippets Groups Projects
Commit 360cf63f authored by Low, Low Jian He (PG/R - Comp Sci & Elec Eng)'s avatar Low, Low Jian He (PG/R - Comp Sci & Elec Eng)
Browse files

Adding compressed version back

parent 609d853f
No related branches found
No related tags found
No related merge requests found
File moved
...@@ -178,7 +178,7 @@ def main(args, model, renderer, device): ...@@ -178,7 +178,7 @@ def main(args, model, renderer, device):
#Create Temp Out Folder #Create Temp Out Folder
filename = os.path.basename(args.vid).removesuffix('.mp4') filename = os.path.basename(args.vid).removesuffix('.mp4')
outfile = os.path.join(args.out_folder, filename) outfile = os.path.join(temp_dir.name, filename)
os.makedirs(outfile, exist_ok=True) os.makedirs(outfile, exist_ok=True)
os.system(f"ffmpeg -nostdin -i {args.vid} -vf fps={fps} {temp_dir.name}/Frame%d.png") os.system(f"ffmpeg -nostdin -i {args.vid} -vf fps={fps} {temp_dir.name}/Frame%d.png")
...@@ -292,7 +292,14 @@ def main(args, model, renderer, device): ...@@ -292,7 +292,14 @@ def main(args, model, renderer, device):
json_path = os.path.join(args.out_folder,f"{os.path.basename(img_path).removesuffix('.png')}_{count}.json") if args.vid == '' else os.path.join(outfile,f"{os.path.basename(img_path).removesuffix('.png')}_{count}.json") json_path = os.path.join(args.out_folder,f"{os.path.basename(img_path).removesuffix('.png')}_{count}.json") if args.vid == '' else os.path.join(outfile,f"{os.path.basename(img_path).removesuffix('.png')}_{count}.json")
with open(json_path, 'w') as f: with open(json_path, 'w') as f:
json.dump(output, f, indent=4) json.dump(output, f, indent=4)
if args.vid != '':
tmp_tar = os.path.join(temp_dir.name, "tmp.tar.xz")
tar_cmd = "tar -C " + temp_dir.name + " -cJf " + tmp_tar + f" {os.path.basename(outfile)}"
os.system(tar_cmd)
os.system(f"cp {tmp_tar} {os.path.join(args.out_folder, os.path.basename(outfile))}.tar.xz")
os.system(f"rm -rf {outfile}")
if temp_dir: if temp_dir:
temp_dir.cleanup() temp_dir.cleanup()
print(f"Temp directory {temp_dir.name} cleaned up") print(f"Temp directory {temp_dir.name} cleaned up")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment