Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,25 +58,23 @@ def resize_video(input_file, new_width):
|
|
| 58 |
|
| 59 |
# Resize the video clip
|
| 60 |
resized_clip = clip.resize(width=new_width_adjusted, height=new_height_adjusted)
|
| 61 |
-
|
| 62 |
-
temp_output_path = 'temp_output/'
|
| 63 |
-
os.makedirs(temp_output_path, exist_ok=True)
|
| 64 |
|
| 65 |
# Check if the file already exists
|
| 66 |
-
if os.path.exists('
|
| 67 |
# Delete the existing file
|
| 68 |
-
os.remove('
|
| 69 |
|
| 70 |
# Write the resized video to a file
|
| 71 |
-
resized_clip.write_videofile('
|
| 72 |
|
| 73 |
# Close the video clip
|
| 74 |
clip.close()
|
| 75 |
|
| 76 |
|
| 77 |
-
final_video_resized = os.path.join(temp_output_path, 'video_resized.mp4')
|
| 78 |
-
|
| 79 |
-
|
|
|
|
| 80 |
|
| 81 |
def run_inference(prompt, video_path, condition, video_length):
|
| 82 |
|
|
|
|
| 58 |
|
| 59 |
# Resize the video clip
|
| 60 |
resized_clip = clip.resize(width=new_width_adjusted, height=new_height_adjusted)
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# Check if the file already exists
|
| 63 |
+
if os.path.exists('video_resized.mp4'):
|
| 64 |
# Delete the existing file
|
| 65 |
+
os.remove('video_resized.mp4')
|
| 66 |
|
| 67 |
# Write the resized video to a file
|
| 68 |
+
resized_clip.write_videofile('video_resized.mp4', codec="libx264")
|
| 69 |
|
| 70 |
# Close the video clip
|
| 71 |
clip.close()
|
| 72 |
|
| 73 |
|
| 74 |
+
#final_video_resized = os.path.join(temp_output_path, 'video_resized.mp4')
|
| 75 |
+
test_w, test_h, fps = get_video_dimension('video_resized.mp4')
|
| 76 |
+
print(f"resized clip dims : {test_w}, {test_h}, {fps}")
|
| 77 |
+
return 'video_resized.mp4'
|
| 78 |
|
| 79 |
def run_inference(prompt, video_path, condition, video_length):
|
| 80 |
|