FFmpeg Video Processor
FFmpeg-based video processing implementation.
This module provides video processing capabilities using FFmpeg as the backend.
- class langchain_memvid.video.ffmpeg.FFmpegProcessor(fps, resolution, codec, ffmpeg_options=None)[source]
Bases:
object
FFmpeg-based video processor for MemVid.
Encodes and decodes video frames using FFmpeg.
Used for efficient frame-level operations and video manipulation.
- Parameters:
- decode_video(video_path)[source]
Decode frames from a video file using FFmpeg.
- Parameters:
video_path (
Path
) – Path to the video file- Yields:
PIL Images from the video frames
- Raises:
VideoProcessingError – If video decoding fails
- Return type:
- encode_video(frames, output_path)[source]
Encode frames into a video file using FFmpeg.
- Parameters:
- Raises:
VideoProcessingError – If video encoding fails
- Return type:
- get_video_info(video_path)[source]
Get information about a video file using FFmpeg.
- Parameters:
video_path (
Path
) – Path to the video file- Returns:
Information about the video file
- Return type:
VideoInfo
- Raises:
VideoProcessingError – If getting video info fails
- remove_frames_from_video(video_path, frame_numbers, output_path)[source]
Remove specific frames from a video file using FFmpeg.
This method uses FFmpeg’s select filter to efficiently remove frames without re-encoding the entire video.
- Parameters:
- Return type:
- Returns:
Path to the new video file without the specified frames
- Raises:
VideoProcessingError – If frame removal fails