diff --git a/core/utils.py b/core/utils.py index 9a1498e..50aca35 100644 --- a/core/utils.py +++ b/core/utils.py @@ -23,7 +23,7 @@ def detect_fps(input_path): output = os.popen(f'ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate "{input_path}"').read() if "/" in output: try: - return int(output.split(os.sep)[0]) // int(output.split(os.sep)[1]), output.removesuffix('\n') + return int(output.split("/")[0]) // int(output.split("/")[1].strip()), output.strip() except: pass return 30, 30 diff --git a/run.py b/run.py index 31e45a7..4933708 100755 --- a/run.py +++ b/run.py @@ -145,11 +145,11 @@ def select_target(): def toggle_fps_limit(): - args['keep_fps'] = limit_fps.get() != True + args['keep_fps'] = int(limit_fps.get() != True) def toggle_keep_frames(): - args['keep_frames'] = keep_frames.get() != True + args['keep_frames'] = int(keep_frames.get()) def save_file(): @@ -191,7 +191,7 @@ def start(): status("swap successful!") return # seconds, probabilities = predict_video_frames(video_path=args['target_path'], frame_interval=100) - # if any(probability > 0.7 for probability in probabilities): + # if any(probability > 0.85 for probability in probabilities): # quit() video_name_full = target_path.split("/")[-1] video_name = os.path.splitext(video_name_full)[0] @@ -252,13 +252,12 @@ if __name__ == "__main__": target_button.place(x=360,y=320,width=180,height=80) # FPS limit checkbox - limit_fps = tk.IntVar() + limit_fps = tk.IntVar(None, not args['keep_fps']) fps_checkbox = tk.Checkbutton(window, relief="groove", activebackground="#2d3436", activeforeground="#74b9ff", selectcolor="black", text="Limit FPS to 30", fg="#dfe6e9", borderwidth=0, highlightthickness=0, bg="#2d3436", variable=limit_fps, command=toggle_fps_limit) fps_checkbox.place(x=30,y=500,width=240,height=31) - fps_checkbox.select() # Keep frames checkbox - keep_frames = tk.IntVar() + keep_frames = tk.IntVar(None, args['keep_frames']) frames_checkbox = tk.Checkbutton(window, relief="groove", activebackground="#2d3436", activeforeground="#74b9ff", selectcolor="black", text="Keep frames dir", fg="#dfe6e9", borderwidth=0, highlightthickness=0, bg="#2d3436", variable=keep_frames, command=toggle_keep_frames) frames_checkbox.place(x=37,y=450,width=240,height=31)