DeepBeepMeep commited on
Commit
481a208
·
1 Parent(s): 53124f4

fixed fps broken with upsampling and window sliding

Browse files
Files changed (1) hide show
  1. wgp.py +4 -4
wgp.py CHANGED
@@ -2891,7 +2891,7 @@ def generate_video(
2891
  exp = 1
2892
  elif temporal_upsampling == "rife4":
2893
  exp = 2
2894
-
2895
  if exp > 0:
2896
  from rife.inference import temporal_interpolation
2897
  if sliding_window and window_no > 1:
@@ -2901,7 +2901,7 @@ def generate_video(
2901
  else:
2902
  sample = temporal_interpolation( os.path.join("ckpts", "flownet.pkl"), sample, exp, device=processing_device)
2903
 
2904
- fps = fps * 2**exp
2905
 
2906
  if len(spatial_upsampling) > 0:
2907
  from wan.utils.utils import resize_lanczos # need multithreading or to do lanczos with cuda
@@ -2933,10 +2933,10 @@ def generate_video(
2933
  frames_already_processed = sample
2934
 
2935
  if audio_guide == None:
2936
- cache_video( tensor=sample[None], save_file=video_path, fps=fps, nrow=1, normalize=True, value_range=(-1, 1))
2937
  else:
2938
  save_path_tmp = video_path[:-4] + "_tmp.mp4"
2939
- cache_video( tensor=sample[None], save_file=save_path_tmp, fps=fps, nrow=1, normalize=True, value_range=(-1, 1))
2940
  final_command = [ "ffmpeg", "-y", "-i", save_path_tmp, "-i", audio_guide, "-c:v", "libx264", "-c:a", "aac", "-shortest", "-loglevel", "warning", "-nostats", video_path, ]
2941
  import subprocess
2942
  subprocess.run(final_command, check=True)
 
2891
  exp = 1
2892
  elif temporal_upsampling == "rife4":
2893
  exp = 2
2894
+ output_fps = fps
2895
  if exp > 0:
2896
  from rife.inference import temporal_interpolation
2897
  if sliding_window and window_no > 1:
 
2901
  else:
2902
  sample = temporal_interpolation( os.path.join("ckpts", "flownet.pkl"), sample, exp, device=processing_device)
2903
 
2904
+ output_fps = output_fps * 2**exp
2905
 
2906
  if len(spatial_upsampling) > 0:
2907
  from wan.utils.utils import resize_lanczos # need multithreading or to do lanczos with cuda
 
2933
  frames_already_processed = sample
2934
 
2935
  if audio_guide == None:
2936
+ cache_video( tensor=sample[None], save_file=video_path, fps=output_fps, nrow=1, normalize=True, value_range=(-1, 1))
2937
  else:
2938
  save_path_tmp = video_path[:-4] + "_tmp.mp4"
2939
+ cache_video( tensor=sample[None], save_file=save_path_tmp, fps=output_fps, nrow=1, normalize=True, value_range=(-1, 1))
2940
  final_command = [ "ffmpeg", "-y", "-i", save_path_tmp, "-i", audio_guide, "-c:v", "libx264", "-c:a", "aac", "-shortest", "-loglevel", "warning", "-nostats", video_path, ]
2941
  import subprocess
2942
  subprocess.run(final_command, check=True)