Spaces:
Running
Running
| import os | |
| import ffmpeg | |
| def extract_frames(video_path: str, frames_dir: str) -> None: | |
| """Extracts frames from a video file using FFmpeg.""" | |
| output_pattern = os.path.join(frames_dir, "video_frame_%04d.jpg") | |
| ffmpeg.input(video_path).output(output_pattern, vf='fps=5', loglevel='quiet').run() | |
| def convert_to_mp4(input_path: str, output_path: str) -> None: | |
| """Converts a video file to MP4 using FFmpeg.""" | |
| ffmpeg.input(input_path).output(output_path).run() | |