fffiloni commited on
Commit
2eba816
1 Parent(s): 67443e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import subprocess
4
  import cv2
5
  from PIL import Image
6
  from moviepy.editor import *
 
7
  from gradio_client import Client
8
  import gradio as gr
9
 
@@ -260,9 +261,9 @@ def infer_auto(project_name, video_in, subject_to_remove):
260
  # Set the desired frame rate (e.g., 12 fps)
261
  new_fps = needed_fps
262
 
263
- # Convert videos to the new frame rate
264
- video1 = video1.set_duration(video1.duration).set_fps(new_fps)
265
- video2 = video2.set_duration(video2.duration).set_fps(new_fps)
266
 
267
  # Save the converted videos
268
  video1.write_videofile(f'masked_{new_fps}fps.mp4', fps=new_fps)
 
4
  import cv2
5
  from PIL import Image
6
  from moviepy.editor import *
7
+ from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
8
  from gradio_client import Client
9
  import gradio as gr
10
 
 
261
  # Set the desired frame rate (e.g., 12 fps)
262
  new_fps = needed_fps
263
 
264
+ # Convert videos to the new frame rate using subclip
265
+ video1 = video1.subclip(0, video1.duration).set_fps(new_fps)
266
+ video2 = video2.subclip(0, video2.duration).set_fps(new_fps)
267
 
268
  # Save the converted videos
269
  video1.write_videofile(f'masked_{new_fps}fps.mp4', fps=new_fps)