fix windows issues fr
This commit is contained in:
parent
976354427c
commit
60dd8888e5
9
run.py
9
run.py
@ -36,6 +36,11 @@ for name, value in vars(parser.parse_args()).items():
|
|||||||
args[name] = value
|
args[name] = value
|
||||||
|
|
||||||
|
|
||||||
|
sep = "/"
|
||||||
|
if os.name == "nt":
|
||||||
|
sep = "\\"
|
||||||
|
|
||||||
|
|
||||||
def start_processing():
|
def start_processing():
|
||||||
if args['gpu']:
|
if args['gpu']:
|
||||||
process_video(args['source_img'], args["frame_paths"])
|
process_video(args['source_img'], args["frame_paths"])
|
||||||
@ -87,7 +92,7 @@ def start():
|
|||||||
process_img(args['source_img'], target_path)
|
process_img(args['source_img'], target_path)
|
||||||
return
|
return
|
||||||
video_name = target_path.split("/")[-1].split(".")[0]
|
video_name = target_path.split("/")[-1].split(".")[0]
|
||||||
output_dir = target_path.replace(target_path.split("/")[-1], "") + "/" + video_name
|
output_dir = target_path.replace(target_path.split("/")[-1], "").rstrip("/") + "/" + video_name
|
||||||
Path(output_dir).mkdir(exist_ok=True)
|
Path(output_dir).mkdir(exist_ok=True)
|
||||||
fps = detect_fps(target_path)
|
fps = detect_fps(target_path)
|
||||||
if not args['keep_fps'] and fps > 30:
|
if not args['keep_fps'] and fps > 30:
|
||||||
@ -99,7 +104,7 @@ def start():
|
|||||||
extract_frames(target_path, output_dir)
|
extract_frames(target_path, output_dir)
|
||||||
args['frame_paths'] = tuple(sorted(
|
args['frame_paths'] = tuple(sorted(
|
||||||
glob.glob(output_dir + f"/*.png"),
|
glob.glob(output_dir + f"/*.png"),
|
||||||
key=lambda x: int(x.split("/")[-1].replace(".png", ""))
|
key=lambda x: int(x.split(sep)[-1].replace(".png", ""))
|
||||||
))
|
))
|
||||||
start_processing()
|
start_processing()
|
||||||
create_video(video_name, fps, output_dir)
|
create_video(video_name, fps, output_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user