keep frames in select folder

This commit is contained in:
Somdev Sangwan 2023-05-29 17:42:52 +05:30 committed by GitHub
parent ae3b2f8d3c
commit 995f3ffd8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

5
run.py
View File

@ -66,13 +66,12 @@ def start():
return
global pool
pool = mp.Pool(psutil.cpu_count()-1)
current_dir = os.getcwd()
target_path = args['target_path']
if is_img(target_path):
process_img(args['source_img'], target_path)
return
video_name = target_path.split("/")[-1].split(".")[0]
output_dir = current_dir + "/" + video_name
output_dir = target_path.replace(target_path.split("/")[-1], "") + "/" + video_name
Path(output_dir).mkdir(exist_ok=True)
fps = detect_fps(target_path)
if not args['keep_fps'] and fps > 30:
@ -88,7 +87,7 @@ def start():
))
start_processing()
create_video(video_name, fps, output_dir)
add_audio(current_dir, output_dir, target_path, args['keep_frames'], args['output_file'])
add_audio(output_dir, target_path, args['keep_frames'], args['output_file'])
save_path = args['output_file'] if args['output_file'] else output_dir + "/" + video_name + ".mp4"
print("\n\nVideo saved as:", save_path, "\n\n")