crates/camera-ffmpeg/README.md
Cross-platform FFmpeg integration for the cap-camera library that provides seamless conversion between native camera frames and FFmpeg video frames. Enables direct use of camera capture data in FFmpeg-based video processing pipelines without additional memory copies or format conversions.
Bridges the gap between cap-camera's unified camera capture API and FFmpeg's video processing ecosystem. Provides zero-copy conversion from platform-specific camera frames (AVFoundation on macOS, Media Foundation/DirectShow on Windows) to FFmpeg video frames while preserving pixel format fidelity and performance.
CapturedFrameExt::to_ffmpeg() - Convert camera frames to FFmpeg video frames with automatic format detectionToFfmpegError for unsupported formats and native errorsmacOS (AVFoundation):
2vuy → UYVY422 (Packed YUV 4:2:2)420v → NV12 (Planar YUV 4:2:0 with interleaved UV)yuvs → YUYV422 (Packed YUV 4:2:2)Windows (Media Foundation/DirectShow):
Extends cap-camera's CapturedFrame with FFmpeg conversion capabilities through the CapturedFrameExt trait. Platform-specific modules handle the native frame format detection and memory layout conversion, while maintaining a unified interface for FFmpeg integration across macOS and Windows camera backends.
The conversion process preserves the original frame's memory layout and copies data efficiently into FFmpeg's expected format, ensuring compatibility with the broader FFmpeg ecosystem for video processing, encoding, and analysis tasks.