Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -56,9 +56,14 @@ def resize_video(input_file, output_file, new_width):
|
|
56 |
|
57 |
# Resize the video clip
|
58 |
resized_clip = clip.resize(width=512, height=new_height_adjusted)
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
# Write the resized video to a file
|
61 |
-
resized_clip.write_videofile(
|
62 |
|
63 |
# Close the video clip
|
64 |
clip.close()
|
@@ -69,10 +74,10 @@ def run_inference(prompt, video_path, condition, video_length):
|
|
69 |
|
70 |
# Specify the input and output paths
|
71 |
input_vid = video_path
|
72 |
-
resized_vid = 'resized.mp4'
|
73 |
|
74 |
# Call the function to resize the video
|
75 |
-
resized_video_path = resize_video(input_vid,
|
|
|
76 |
width, height, fps = get_video_dimension(resized_video_path)
|
77 |
|
78 |
print(f"{width} x {height} | {fps}")
|
|
|
56 |
|
57 |
# Resize the video clip
|
58 |
resized_clip = clip.resize(width=512, height=new_height_adjusted)
|
59 |
+
|
60 |
+
# Check if the file already exists
|
61 |
+
if os.path.exists('video_resized.mp4'):
|
62 |
+
# Delete the existing file
|
63 |
+
os.remove('video_resized.mp4')
|
64 |
+
|
65 |
# Write the resized video to a file
|
66 |
+
resized_clip.write_videofile('video_resized.mp4', codec="libx264")
|
67 |
|
68 |
# Close the video clip
|
69 |
clip.close()
|
|
|
74 |
|
75 |
# Specify the input and output paths
|
76 |
input_vid = video_path
|
|
|
77 |
|
78 |
# Call the function to resize the video
|
79 |
+
resized_video_path = resize_video(input_vid, new_width=512)
|
80 |
+
print(resized_video)
|
81 |
width, height, fps = get_video_dimension(resized_video_path)
|
82 |
|
83 |
print(f"{width} x {height} | {fps}")
|