__________________________
< Hello fellow Rustaceans! >
--------------------------
\
\
_~^~^~_
\) / o o \ (/
'_ - _'
/ '-----' \
π¦ CrabCamera will be free forever. π¦ No asterisks. No "free for now." No pivot to paid.
π¦ CrabCamera is the first production-ready desktop camera plugin for Tauri applications. It provides unified camera access across Windows, macOS, and Linux with professional controls and zero-config setup. It's designed to be the invisible infrastructure that makes desktop camera apps just work.
| Feature | CrabCamera | Web APIs | Other Plugins |
|---|---|---|---|
| Desktop Native | Windows/macOS/Linux π | Limited browser | Mobile-only |
| Hardware Access | Direct camera control π | Browser restricted | Basic access |
| Professional Controls | Auto-focus, exposure π | Limited | Basic |
| Cross-Platform | Unified API π | Platform dependent | Single platform |
| Production Ready | 278 comprehensive tests π | No guarantees | Proof-of-concept |
| Memory Safety | Zero unsafe code π | N/A | Manual management |
- Photography: Photo booth apps, image editors, content creation tools
- Security: Surveillance systems, access control, monitoring dashboards
- Medical: Imaging interfaces, patient documentation, diagnostic tools
- Industrial: Quality control, inspection systems, documentation cameras
- Education: Interactive learning tools, virtual labs, presentation software
- Communication: Video chat apps, streaming tools, conference software
BONUS: Professional camera controls with platform-optimized settings for maximum image quality.
[dependencies]
crabcamera = "0.5.0"
tauri = { version = "2.0", features = ["protocol-asset"] }// src-tauri/src/main.rs
use crabcamera;
fn main() {
tauri::Builder::default()
.plugin(crabcamera::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}// tauri.conf.json
{
"plugins": {
"crabcamera": {}
}
}import { invoke } from '@tauri-apps/api/tauri';
// Initialize camera system
await invoke('initialize_camera_system');
// Get available cameras
const cameras = await invoke('get_available_cameras');
console.log('Available cameras:', cameras);
// Get recommended format for high quality
const format = await invoke('get_recommended_format');
// Capture a photo
const photo = await invoke('capture_single_photo', {
deviceId: cameras[0].id,
format: format
});- Device Enumeration: Automatic discovery of all connected cameras
- Format Negotiation: Resolution, FPS, and color format selection
- Professional Settings: Auto-focus, auto-exposure, white balance
- Multi-camera Support: Switch between multiple cameras seamlessly
- Error Recovery: Robust handling of device disconnection and errors
- Windows: DirectShow/MediaFoundation with advanced camera controls
- macOS: AVFoundation with Metal acceleration support
- Linux: V4L2 with comprehensive device support
- Unified API: Same code works across all platforms
- Professional Controls: Focus, exposure, white balance on all platforms
- Zero-Copy Operations: Minimal memory allocations where possible
- Async/Await: Non-blocking operations throughout
- Resource Management: Automatic cleanup and device release
- Memory Safety: Built with Rust's memory safety guarantees
- Thread Safety: Concurrent access with proper synchronization
// Initialize the camera system
initialize_camera_system() -> Result<String>
// Get all available cameras with capabilities
get_available_cameras() -> Result<Vec<CameraDeviceInfo>>
// Get platform-specific information
get_platform_info() -> Result<PlatformInfo>
// Test camera system functionality
test_camera_system() -> Result<SystemTestResult>// Check if specific camera is available
check_camera_availability(device_id: String) -> Result<bool>
// Get supported formats for a camera
get_camera_formats(device_id: String) -> Result<Vec<CameraFormat>>
// Get recommended settings for quality photography
get_recommended_format() -> Result<CameraFormat>
get_optimal_settings() -> Result<CameraInitParams>// Single photo capture
capture_single_photo(device_id: String, format: CameraFormat) -> Result<CameraFrame>
// Photo sequence for burst mode
capture_photo_sequence(params: SequenceParams) -> Result<Vec<CameraFrame>>
// Real-time streaming
start_camera_preview(device_id: String) -> Result<()>
stop_camera_preview() -> Result<()>
// Save frames to disk
save_frame_to_disk(frame: CameraFrame, path: String) -> Result<()>// Apply camera controls (focus, exposure, white balance, etc.)
apply_camera_controls(device_id: String, controls: CameraControls) -> Result<()>
// Get current camera control values
get_camera_controls(device_id: String) -> Result<CameraControls>
// Test what controls are supported by camera
test_camera_capabilities(device_id: String) -> Result<CameraCapabilities>
// Get performance metrics
get_camera_performance(device_id: String) -> Result<CameraPerformanceMetrics>// Handle camera permissions properly
request_camera_permission() -> Result<bool>
check_camera_permission_status() -> Result<PermissionStatus>I built CrabCamera because desktop applications deserve native camera access without the limitations of web APIs or mobile-only plugins.
This is my commitment: CrabCamera stays MIT licensed, forever. If you want to support development, sponsor it. If you don't, just build something incredible with it.
π¦ CrabCamera saves developers weeks of cross-platform camera integration. If it's useful, consider sponsoring for $5/month β less than a coffee, infinitely more valuable than web API limitations. π¦
| Metric | CrabCamera | Web APIs | Mobile Plugins |
|---|---|---|---|
| Desktop Support | Full native | Browser dependent | None |
| Camera Access | Direct hardware | getUserMedia limited | N/A |
| Image Quality | Professional controls | Basic settings | Basic |
| Cross-Platform | Windows/macOS/Linux | Browser variation | iOS/Android only |
| Performance | Native speed | Browser overhead | N/A |
| Reliability | 278 tests passing | No guarantees | Varies |
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β nokhwa β β Platform Controlsβ β CrabCamera β
β (Capture) β β (Advanced) β β (Unified API) β
βββββββββββββββββββ€ ββββββββββββββββββββ€ βββββββββββββββββββ€
β β’ Frame capture β β β’ Focus control β β β’ Generic types β
β β’ Resolution β β β’ Exposure β β β’ Error handlingβ
β β’ Format β β β’ White balance β β β’ Cross-platformβ
β β’ Start/Stop β β β’ Brightness β β β’ Thread safety β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Windows: nokhwa capture + MediaFoundation controls
- macOS: AVFoundation for both capture and controls
- Linux: nokhwa capture + V4L2 controls
- Unified API: Same control interface across all platforms
- Rust + Tokio: Memory-safe, async performance
- Tauri 2.0 Plugin: Modern plugin architecture
- Platform Backends: MediaFoundation, AVFoundation, V4L2
- COM Interface Management: Thread-safe Windows controls
- Zero unsafe code: Memory safety guaranteed (except platform COM interfaces)
pub struct CameraDeviceInfo {
pub id: String,
pub name: String,
pub description: String,
pub is_available: bool,
pub supports_formats: Vec<CameraFormat>,
}
pub struct CameraFormat {
pub width: u32,
pub height: u32,
pub fps: f32,
pub format_type: String, // "RGB8", "JPEG", etc.
}
pub struct CameraFrame {
pub data: Vec<u8>,
pub width: u32,
pub height: u32,
pub format: String,
pub timestamp: DateTime<Utc>,
}
pub struct CameraControls {
pub auto_focus: Option<bool>,
pub focus_distance: Option<f32>, // 0.0 = infinity, 1.0 = closest
pub auto_exposure: Option<bool>,
pub exposure_time: Option<f32>, // seconds
pub white_balance: Option<WhiteBalance>,
pub brightness: Option<f32>, // -1.0 to 1.0
pub contrast: Option<f32>, // -1.0 to 1.0
pub saturation: Option<f32>, // -1.0 to 1.0
}
pub struct CameraCapabilities {
pub supports_auto_focus: bool,
pub supports_manual_focus: bool,
pub supports_auto_exposure: bool,
pub supports_manual_exposure: bool,
pub supports_white_balance: bool,
pub focus_range: Option<(f32, f32)>,
pub exposure_range: Option<(f32, f32)>,
}pub enum Platform {
Windows,
MacOS,
Linux,
Unknown,
}
// Automatic platform detection
let platform = Platform::current();- π Bug Reports: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Documentation: docs.rs/crabcamera
- π Sponsorship: GitHub Sponsors
CrabCamera is open source, not open contribution. The code is freely available under the MIT license, but pull requests are not accepted by default. See CONTRIBUTING.md for details.
This model ensures consistent quality across all platforms and clear project direction.
See our amazing sponsors who make π¦ CrabCamera possible! π
Sponsorship Tiers:
- $5/month: Coffee tier - My eternal gratitude + sponsor badge
- $25/month: Developer supporter - Priority support + name in SPONSORS.md
- $100/month: Corporate backer - Logo on README + monthly office hours
- $500/month: Enterprise partner - Direct support + feature requests
Companies: Need invoicing? Email michaelallenkuykendall@gmail.com
β Ready for production:
- Memory-safe Rust implementation
- 278 comprehensive tests passing
- Zero unsafe code
- Comprehensive error handling
- Async/await throughout
- Cross-platform compatibility verified
- Real hardware validation (OBSBOT Tiny 4K)
β Use cases in production:
- Desktop photography applications
- Security and surveillance systems
- Medical imaging interfaces
- Industrial inspection tools
- Educational software platforms
- Communication and streaming apps
// Simple photo booth with camera selection
const cameras = await invoke('get_available_cameras');
const selectedCamera = cameras[0];
const format = await invoke('get_recommended_format');
// Take photo when user clicks
document.getElementById('capture').onclick = async () => {
const photo = await invoke('capture_single_photo', {
deviceId: selectedCamera.id,
format: format
});
// Display photo in UI
displayPhoto(photo);
};// Monitor multiple cameras
const cameras = await invoke('get_available_cameras');
for (const camera of cameras) {
await invoke('start_camera_preview', { deviceId: camera.id });
// Set up streaming handlers for each camera
setupCameraStream(camera);
}MIT License - forever and always.
Philosophy: Desktop applications deserve native camera access. π¦ CrabCamera is camera infrastructure. π·
- Audio Recording: Full audio capture with Opus encoding
- A/V Sync: Shared PTS clock ensures Β±40ms audio/video synchronization
- Audio Device Enumeration:
list_audio_devices()with sample rate, channels, default status - Integrated Recording:
start_recording()now acceptsaudioDeviceIdparameter - Fuzz Testing: 8 proptest-based fuzz tests for encoder robustness
- Benchmark Suite: Criterion benchmarks for H264 and Opus encoding
- 278 Tests: Up from 157, with live OBSBOT Tiny 4K validation
- Critical Fix: PTS double-counting bug in audio encoder
- Critical Fix: Mock camera was incorrectly used during
cargo run - PNG Save Fixed:
save_frame_to_disk()now properly encodes PNG/JPEG - Performance: Camera warmup reduced from 10 frames to 5 frames
- macOS Fixed: Objective-C block syntax and nokhwa API compatibility
- Quality Validation: Automatic blur/exposure detection with retry
- TOML Configuration: Full runtime config with hot-reload
- Focus Stacking: Computational photography for macro shots
- Device Monitoring: Hot-plug detection for camera connect/disconnect
- Professional Windows Controls: Full focus, exposure, white balance control
- Hybrid Architecture: nokhwa capture + MediaFoundation controls
- Thread-Safe COM: Proper Windows COM interface management
Forever maintainer: Michael A. Kuykendall
Promise: This will never become a paid product
Mission: Making desktop camera development effortless
"π¦ Native performance. Cross-platform compatibility. Zero hassle. π·"
π¦π¦π¦ Happy Coding! π¦π¦π¦
Made with β€οΈ and Rust
π· Capture the moment π·