Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,15 +47,17 @@ def adjust_to_multiple_of_12(number):
|
|
| 47 |
def resize_video(input_file, new_width):
|
| 48 |
# Load the video clip
|
| 49 |
clip = VideoFileClip(input_file)
|
| 50 |
-
|
| 51 |
# Calculate the aspect ratio
|
| 52 |
ratio = new_width / clip.size[0]
|
| 53 |
new_height = int(clip.size[1] * ratio)
|
| 54 |
new_height_adjusted = adjust_to_multiple_of_12(new_height)
|
|
|
|
| 55 |
print(f"OLD H: {new_height} | NEW H: {new_height_adjusted}")
|
|
|
|
| 56 |
|
| 57 |
# Resize the video clip
|
| 58 |
-
resized_clip = clip.resize(width=
|
| 59 |
|
| 60 |
# Check if the file already exists
|
| 61 |
if os.path.exists('video_resized.mp4'):
|
|
|
|
| 47 |
def resize_video(input_file, new_width):
|
| 48 |
# Load the video clip
|
| 49 |
clip = VideoFileClip(input_file)
|
| 50 |
+
print(f"WIDTH TARGET: {new_width}")
|
| 51 |
# Calculate the aspect ratio
|
| 52 |
ratio = new_width / clip.size[0]
|
| 53 |
new_height = int(clip.size[1] * ratio)
|
| 54 |
new_height_adjusted = adjust_to_multiple_of_12(new_height)
|
| 55 |
+
new_width_adjusted = adjust_to_multiple_of_12(new_width)
|
| 56 |
print(f"OLD H: {new_height} | NEW H: {new_height_adjusted}")
|
| 57 |
+
print(f"OLD W: {new_width} | NEW W: {new_width_adjusted}")
|
| 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'):
|