π¦ CrabCamera: The Desktop Camera Plugin for Tauri π·
__________________________
< Hello fellow Rustaceans! >
--------------------------
\
\
_~^~^~_
\) / o o \ (/
'_ - _'
/ '-----' \
π¦ CrabCamera will be free forever. π¦ No asterisks. No "free for now." No pivot to paid.
π¦ What is CrabCamera?
π¦ 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 | 157 comprehensive tests π | No guarantees | Proof-of-concept |
| Memory Safety | Zero unsafe code π | N/A | Manual management |
π― Perfect for Desktop Applications π¦
- 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.
π¦ Quick Start (30 seconds) π·
Installation
[]
= "0.4.1"
= { = "2.0", = ["protocol-asset"] }
Tauri Integration
// src-tauri/src/main.rs
use crabcamera;
// tauri.conf.json
Frontend Usage
import from '@tauri-apps/api/tauri';
// Initialize camera system
await ;
// Get available cameras
const cameras = await ;
console.log;
// Get recommended format for high quality
const format = await ;
// Capture a photo
const photo = await ;
π¦ Professional Camera Features π¦
π§ Hardware Control π¦
- 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
π₯οΈ Cross-Platform Native π¦
- 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
β‘ Performance & Memory π¦
- 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
π§ Available Commands π¦
Initialization & Discovery
// Initialize the camera system
initialize_camera_system // Get all available cameras with capabilities
get_available_cameras // Get platform-specific information
get_platform_info // Test camera system functionality
test_camera_system
Camera Operations
// Check if specific camera is available
check_camera_availability // Get supported formats for a camera
get_camera_formats // Get recommended settings for quality photography
get_recommended_format
Capture & Streaming
// Single photo capture
capture_single_photo // Photo sequence for burst mode
capture_photo_sequence // Real-time streaming
start_camera_preview // Save frames to disk
save_frame_to_disk
Professional Camera Controls
// Apply camera controls (focus, exposure, white balance, etc.)
apply_camera_controls // Get current camera control values
get_camera_controls // Test what controls are supported by camera
test_camera_capabilities // Get performance metrics
get_camera_performance
Permissions & Security
// Handle camera permissions properly
request_camera_permission
π¦ Why CrabCamera Will Always Be Free π·
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. π¦
π Performance Comparison π¦
| 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 | 157 tests passing | No guarantees | Varies |
ποΈ Technical Architecture π¦
Hybrid Capture + Controls Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β 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 β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Platform-Specific Implementations
- 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
Key Technologies
- 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)
π API Reference π¦
Core Types
Platform Detection
// Automatic platform detection
let platform = current;
π¦ Community & Support π·
- π Bug Reports: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Documentation: docs.rs/crabcamera
- π Sponsorship: GitHub Sponsors
Governance
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.
Sponsors
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
π Production Usage π¦
β Ready for production:
- Memory-safe Rust implementation
- 157 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
π‘ Examples & Integration π¦
Photo Booth Application
// Simple photo booth with camera selection
const cameras = await ;
const selectedCamera = cameras;
const format = await ;
// Take photo when user clicks
document. ;
Multi-Camera Security System
// Monitor multiple cameras
const cameras = await ;
π License & Philosophy π¦
MIT License - forever and always.
Philosophy: Desktop applications deserve native camera access. π¦ CrabCamera is camera infrastructure. π·
π What's New in v0.4.x
π v0.4.1: Bug Fixes, Performance & DX (December 2025)
- Critical Fix: Mock camera was incorrectly used during
cargo run- now uses real cameras - PNG Save Fixed:
save_frame_to_disk()now properly encodes PNG/JPEG instead of raw bytes - Performance: Camera warmup reduced from 10 frames to 5 frames (~250ms faster)
- macOS Fixed: Objective-C block syntax and nokhwa API compatibility resolved
- DX Improvement: New
get_system_diagnostics()command for troubleshooting - Test Suite: 157 tests passing (up from 80) with real hardware validation
- Flaky Test Fixed:
test_capture_performancetimeout increased for reliability
π v0.4.0: Quality Intelligence & Configuration
- 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
π v0.3.0: Windows MediaFoundation Camera Controls
- Professional Windows Controls: Full focus, exposure, white balance, brightness, contrast, and saturation control
- Hybrid Architecture: nokhwa capture + MediaFoundation controls for best of both worlds
- Thread-Safe COM: Proper Windows COM interface management for Tauri async commands
- Capability Detection: Runtime testing of which controls each camera supports
- Unified API: Same control interface across Windows, macOS, and Linux
π§ Technical Improvements
- WindowsCamera Struct: Combines nokhwa capture with MediaFoundation controls
- MediaFoundationControls: Full COM interface wrapper with resource management
- Platform Integration: Updated PlatformCamera enum to use Windows-specific implementation
- Error Handling: Graceful degradation when controls aren't supported
- Documentation: Comprehensive technical architecture documentation
π Cross-Platform Parity Achieved
Windows users now get the same professional camera control experience as macOS and Linux users!
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 π·