High-performance automated fancam generator. It takes a standard landscape video and a reference photo of a person (say, your bias), tracks them, and generates a stabilized, vertical (9:16) cropped video locked onto them.
It features a modular Rust core for high-speed video processing, a CLI for batch operations, and a modern Tauri v2 desktop application for easy usage.
--threshold value end-to-end (CLI + GUI).detect, identify, render) for targeted profiling.fast_image_resize) for crop and letterbox operations.The project is organized as a Cargo workspace:
fancam-core/: The engine. Handles FFmpeg transcoding, ONNX inference, Kalman tracking, and image processing.cli/: A command-line interface wrapper for the core engine.src-tauri/ & ui/: The Desktop application built with Tauri 2 and Svelte 5.
To build and run this project, you need:
sudo apt install libavutil-dev libavformat-dev libavcodec-dev libswscale-devbrew install ffmpegFFMPEG_DIR environment variable to your FFmpeg shared build.This project requests CoreML execution when available.
models/onnxruntime/lib/libonnxruntime.dylib.Clone the repository:
git clone https://github.com/your-username/focus-lock-rs.git
cd focus-lock-rs
Download Models:
Create a models/ directory in the root and download the following ONNX models:
yolov8n.onnx (YOLOv8 Nano)w600k_mbf.onnx (MobileFaceNet / ArcFace)Build the CLI:
cargo build --release -p cli
The GUI allows you to select files via drag-and-drop and visualize progress.
Install frontend dependencies:
cd ui
npm install
Run in Development Mode:
npm run tauri:dev
For near-production processing speed while iterating UI, use:
npm run tauri:dev:release
Build for Production:
npm run tauri:build
The executable will be located in src-tauri/target/release/bundle/.
The CLI provides direct access to the pipeline phases.
The primary command. It performs detection, identification, tracking, and rendering in one pass.
cargo run --release -p cli -- fancam \
--video "/path/to/concert.mp4" \
--bias "/path/to/face_photo.jpg" \
--output "output_fancam.mp4" \
--yolo-model "models/yolov8n.onnx" \
--face-model "models/w600k_mbf.onnx" \
--threshold 0.6
Smoke Test (Grayscale): Verifies FFmpeg linkage and basic video I/O.
cargo run -p cli -- gray --input video.mp4 --output gray.mp4
Debug Detection: Draws bounding boxes around all detected people without cropping.
cargo run -p cli -- detect --input video.mp4 --output boxes.mp4
Contributions are welcome! Install rustfmt and gimme your PRs.
cargo fmt
cargo test