Spaces:
Running
on
Zero
Running
on
Zero
cap input at 24 FPS on shared UI
Browse files
app.py
CHANGED
|
@@ -82,6 +82,8 @@ snapshot_download(
|
|
| 82 |
)
|
| 83 |
|
| 84 |
is_shared_ui = True if "fffiloni/SVFR-demo" in os.environ['SPACE_ID'] else False
|
|
|
|
|
|
|
| 85 |
from moviepy.editor import VideoFileClip
|
| 86 |
|
| 87 |
def process_video(input_path):
|
|
@@ -112,9 +114,12 @@ def process_video(input_path):
|
|
| 112 |
# If no trimming is needed, copy the file to output_path
|
| 113 |
if mp4_path != output_path:
|
| 114 |
shutil.copy(mp4_path, output_path)
|
| 115 |
-
|
| 116 |
-
#
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
BASE_DIR = '.'
|
| 120 |
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
is_shared_ui = True if "fffiloni/SVFR-demo" in os.environ['SPACE_ID'] else False
|
| 85 |
+
|
| 86 |
+
import ffmpeg
|
| 87 |
from moviepy.editor import VideoFileClip
|
| 88 |
|
| 89 |
def process_video(input_path):
|
|
|
|
| 114 |
# If no trimming is needed, copy the file to output_path
|
| 115 |
if mp4_path != output_path:
|
| 116 |
shutil.copy(mp4_path, output_path)
|
| 117 |
+
|
| 118 |
+
# Ensure framerate is capped at 24 FPS
|
| 119 |
+
final_output_path = os.path.join(temp_folder, "final_trimmed_capped_24_fps.mp4")
|
| 120 |
+
ffmpeg.input(output_path).output(final_output_path, r=24, vcodec='libx264').run(overwrite_output=True)
|
| 121 |
+
|
| 122 |
+
return final_output_path, temp_folder
|
| 123 |
|
| 124 |
BASE_DIR = '.'
|
| 125 |
|