File size: 478 Bytes
077d8c0
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

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()