Safe Rust wrapper around libobs-wrapper for streaming and recording functionality
[!INFO] β Migration to libobs-rs completed β Using stable, production-grade libobs-wrapper bindings instead of manually built obs-studio with bindgen
Warning
The current release only works on Linux based systems
- RevoStream β coming soon
Add to your Cargo.toml:
[dependencies]
revo-lib = { git = "https://github.com/revoproject/revo-lib" }| Aspect | Before | After |
|---|---|---|
| FFI Bindings | Manual bindgen from C headers | libobs-wrapper pre-built bindings |
| Build Complexity | Clone obs-studio, CMake, compile (5+ min) | Use pre-built crate (~30s) |
| Local Size | 231MB (obs-studio sources) | 0MB (external dependency) |
| Output Wrappers | Raw *mut obs_output pointers |
Safe ObsOutputRef with trait-based API |
| Threading | Atomic flags for init state | Thread-safe context with RAII |
| Error Handling | Custom RevoLibError enum |
Conversion from libobs_wrapper::ObsError |
Before:
- β Manual obs-studio cloning (231MB+)
- β Bindgen FFI generation at build time
- β Raw C pointer management
- β Duplicated output code (StreamingOutput + RecordingOutput)
- β Single-threaded initialization
After:
- β Pre-built, production-grade libobs-wrapper
- β Safe, idiomatic Rust abstractions
- β
Trait-based polymorphic outputs (
ObsOutputTrait) - β DRY principle (unified output handling)
- β Thread-safe context with automatic cleanup (RAII)
======================== CHANGE SUMMARY ========================
[raw libobs FFI] ---> [libobs-wrapper]
| |
| +-- safe bindings
| +-- RAII context
| +-- shared output wrapper
|
+-- removed:
- bindgen build step
- obs-studio local source tree
- duplicated streaming / recording code
================================================================
| Crate | Purpose | Version |
|---|---|---|
libobs-wrapper |
Safe Rust wrapper around libobs | From GitHub main |
Removed:
β Replaced by libobs-wrapperbindgenβ Handled by libobs-wrapperlibcobs-studio sourcesβ No longer needed
// Runtime initialization
let ctx = revo_lib::runtime::ObsContext::startup("en-US", None)?;
// Streaming
use revo_lib::streaming::StreamingOutput;
let stream = StreamingOutput::from_raw(output)?;
stream.start()?;
stream.stop();
// Recording
use revo_lib::recording::RecordingOutput;
let recording = RecordingOutput::from_raw(output)?;
recording.start()?;
recording.stop();use revo_lib::error::{RevoLibError, RevoLibResult};
match some_operation() {
Ok(result) => { /* ... */ }
Err(RevoLibError::ObsStartupFailed) => eprintln!("OBS init failed"),
Err(RevoLibError::Other(msg)) => eprintln!("Error: {}", msg),
Err(e) => eprintln!("Other error: {}", e),
}- cleanup.sh - Clean up all built files
This project is licensed under the same terms as OBS Studio (GNU General Public License v3.0 or later).