fffiloni commited on
Commit
11cb0d7
·
1 Parent(s): d41f2d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -58,20 +58,22 @@ 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
  # 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
- temp_output_path = 'temp_output/'
74
- os.makedirs(temp_output_path, exist_ok=True)
75
  final_video_resized = os.path.join(temp_output_path, 'video_resized.mp4')
76
 
77
  return final_video_resized
 
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('temp_output/video_resized.mp4'):
67
  # Delete the existing file
68
+ os.remove('temp_output/video_resized.mp4')
69
 
70
  # Write the resized video to a file
71
+ resized_clip.write_videofile('temp_output/video_resized.mp4', codec="libx264")
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
  return final_video_resized