Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -110,18 +110,18 @@ def get_frames(video_in, img_type):
|
|
| 110 |
frames = []
|
| 111 |
#resize the video
|
| 112 |
# Cut the video to the first 5 seconds
|
| 113 |
-
video_out = f"{img_type}_video_cut.mp4"
|
| 114 |
|
| 115 |
-
ffmpeg_extract_subclip(video_in, t1=0, t2=3, targetname=video_out)
|
| 116 |
# Now, proceed with resizing the cut video
|
| 117 |
-
clip = VideoFileClip(
|
| 118 |
|
| 119 |
#check fps
|
| 120 |
|
| 121 |
-
if clip.fps >
|
| 122 |
-
print("vide rate is over
|
| 123 |
clip_resized = clip.resize(width=512)
|
| 124 |
-
clip_resized.write_videofile(f"{img_type}_video_resized.mp4", fps=
|
| 125 |
else:
|
| 126 |
print("video rate is OK")
|
| 127 |
clip_resized = clip.resize(width=512)
|
|
|
|
| 110 |
frames = []
|
| 111 |
#resize the video
|
| 112 |
# Cut the video to the first 5 seconds
|
| 113 |
+
#video_out = f"{img_type}_video_cut.mp4"
|
| 114 |
|
| 115 |
+
#ffmpeg_extract_subclip(video_in, t1=0, t2=3, targetname=video_out)
|
| 116 |
# Now, proceed with resizing the cut video
|
| 117 |
+
clip = VideoFileClip(video_in)
|
| 118 |
|
| 119 |
#check fps
|
| 120 |
|
| 121 |
+
if clip.fps > 30:
|
| 122 |
+
print("vide rate is over 30, resetting to 30")
|
| 123 |
clip_resized = clip.resize(width=512)
|
| 124 |
+
clip_resized.write_videofile(f"{img_type}_video_resized.mp4", fps=30)
|
| 125 |
else:
|
| 126 |
print("video rate is OK")
|
| 127 |
clip_resized = clip.resize(width=512)
|