From 644fb2a5ab4a2bd1e0e230a49103fafbd39db47d Mon Sep 17 00:00:00 2001 From: s9roll7 Date: Sat, 11 Mar 2023 11:46:37 +0900 Subject: [PATCH] Changed the method of specifying the path to the executable file. Maybe it will work on linux, mac, or colab, but I don't have the environment, so I haven't checked yet. The issue of how to run ebsynth itself in those environments is also not known --- stage1.py | 10 ++++++++-- stage8.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stage1.py b/stage1.py index cc1e8e1..6a763d8 100644 --- a/stage1.py +++ b/stage1.py @@ -147,7 +147,13 @@ def create_mask_clipseg(input_dir, output_dir, clipseg_mask_prompt, clipseg_excl def create_mask_transparent_background(input_dir, output_dir, tb_use_fast_mode, tb_use_jit, st1_mask_threshold): fast_str = " --fast" if tb_use_fast_mode else "" jit_str = " --jit" if tb_use_jit else "" - subprocess.call("venv\\Scripts\\transparent-background --source " + input_dir + " --dest " + output_dir + " --type map" + fast_str + jit_str, shell=True) + bin_path = os.path.join("venv", "Scripts") + bin_path = os.path.join(bin_path, "transparent-background") + + if os.path.isfile(bin_path) or os.path.isfile(bin_path + ".exe"): + subprocess.call(bin_path + " --source " + input_dir + " --dest " + output_dir + " --type map" + fast_str + jit_str, shell=True) + else: + subprocess.call("transparent-background --source " + input_dir + " --dest " + output_dir + " --type map" + fast_str + jit_str, shell=True) mask_imgs = glob.glob( os.path.join(output_dir, "*.png") ) @@ -194,7 +200,7 @@ def ebsynth_utility_stage1(dbg, project_args, frame_width, frame_height, st1_mas png_path = os.path.join(frame_path , "%05d.png") # ffmpeg.exe -ss 00:00:00 -y -i %1 -qscale 0 -f image2 -c:v png "%05d.png" - subprocess.call("ffmpeg.exe -ss 00:00:00 -y -i " + original_movie_path + " -qscale 0 -f image2 -c:v png " + png_path, shell=True) + subprocess.call("ffmpeg -ss 00:00:00 -y -i " + original_movie_path + " -qscale 0 -f image2 -c:v png " + png_path, shell=True) dbg.print("frame extracted") diff --git a/stage8.py b/stage8.py index a03bd71..8f0f112 100644 --- a/stage8.py +++ b/stage8.py @@ -64,7 +64,7 @@ def merge_bg_src(base_frame_dir, bg_dir, frame_mask_path, tmp_dir, bg_type, mask def extract_frames(movie_path , output_dir, fps): png_path = os.path.join(output_dir , "%05d.png") # ffmpeg.exe -ss 00:00:00 -y -i %1 -qscale 0 -f image2 -c:v png "%05d.png" - subprocess.call("ffmpeg.exe -ss 00:00:00 -y -i " + movie_path + " -vf fps=" + str( round(fps, 2)) + " -qscale 0 -f image2 -c:v png " + png_path, shell=True) + subprocess.call("ffmpeg -ss 00:00:00 -y -i " + movie_path + " -vf fps=" + str( round(fps, 2)) + " -qscale 0 -f image2 -c:v png " + png_path, shell=True) def ebsynth_utility_stage8(dbg, project_args, bg_src, bg_type, mask_blur_size, mask_threshold, fg_transparency, export_type): dbg.print("stage8")