diff --git a/Extract_Compressed_HaMeR.py b/Extract_HaMeR_Multi similarity index 100% rename from Extract_Compressed_HaMeR.py rename to Extract_HaMeR_Multi diff --git a/Extract_Uncompressed_HaMeR.py b/Extract_HaMeR_Single similarity index 97% rename from Extract_Uncompressed_HaMeR.py rename to Extract_HaMeR_Single index 1b12d0b0eee6030160b8d38d3e29d995292debb5..cea8f1fec3f8af8c7a0e029d29f4a95f98fb129a 100644 --- a/Extract_Uncompressed_HaMeR.py +++ b/Extract_HaMeR_Single @@ -178,7 +178,7 @@ def main(args, model, renderer, device): #Create Temp Out Folder 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.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): 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: 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: temp_dir.cleanup() print(f"Temp directory {temp_dir.name} cleaned up")