Pure Rust reconstruction of OpenCV + FFmpeg — A patent-free, memory-safe multimedia and computer vision framework.
OxiMedia is a clean room, Pure Rust reconstruction of both FFmpeg (multimedia processing) and OpenCV (computer vision) — unified in a single cohesive framework.
Codec encoding/decoding (AV1, VP9, VP8, Theora, Opus, Vorbis, FLAC, MP3), container muxing/demuxing (MP4, MKV, MPEG-TS, OGG), streaming protocols (HLS, DASH, RTMP, SRT, WebRTC, SMPTE 2110), transcoding pipelines, filter graphs (DAG-based), audio metering (EBU R128), loudness normalization, packaging (CMAF, DRM/CENC), and server-side media delivery.
Computer vision (object detection, motion tracking, video enhancement, quality assessment), professional image I/O (DPX, OpenEXR, TIFF), video stabilization, scene analysis, shot detection, denoising (spatial/temporal/hybrid), camera calibration, color management (ICC, ACES, HDR), video scopes (waveform, vectorscope, histogram), and forensic analysis (ELA, PRNU, copy-move detection).
FFmpeg is the de facto standard for multimedia processing, but it is written in C with patent-encumbered codecs (H.264, H.265, AAC), chronic memory safety vulnerabilities, and notoriously complex build systems requiring dozens of system libraries.
OpenCV is the de facto standard for computer vision, but it depends on C++ with complex CMake builds, optional proprietary modules (CUDA, Intel IPP), and heavy system-level dependencies.
OxiMedia unifies both into a single Pure Rust framework with zero C/Fortran dependencies:
| FFmpeg | OpenCV | OxiMedia | |
|---|---|---|---|
| Language | C | C++ | Pure Rust |
| Memory safety | Manual | Manual | Compile-time guaranteed |
| Patent-free codecs | Opt-in | N/A | Default (AV1, VP9, Opus, FLAC) |
| Install | ./configure && make + system deps |
cmake + system deps |
cargo add oximedia |
| WASM support | Limited (Emscripten) | Limited (Emscripten) | Native (wasm32-unknown-unknown) |
| CV + Media unified | No | No | Yes — single framework |
From the FFmpeg world: codec encode/decode, container mux/demux, streaming (HLS/DASH/RTMP/SRT/WebRTC), transcoding pipelines, filter graphs, audio processing, packaging, and media server.
From the OpenCV world: detection, tracking, stabilization, scene analysis, shot detection, denoising, calibration, image I/O (DPX/EXR/TIFF), color science, quality metrics (PSNR/SSIM/VMAF), and forensics.
One cargo add — no battling system library installations, no pkg-config, no LD_LIBRARY_PATH, no brew install ffmpeg opencv.
OxiMedia is a production-grade framework at v0.1.8 (active cycle, 2026-06-02):
| Metric | Value |
|---|---|
| Total crates | 109 |
| Total SLOC (Rust) | ~2,752,000 |
| Tests passing | 100,278 (0 failures, 0 warnings — cargo nextest run --workspace --all-features) |
| Stable crates | 109 |
| Alpha crates | 0 |
| Partial crates | 0 |
| License | Apache 2.0 |
| MSRV | Rust 1.85+ |
OxiMedia 0.1.7 introduced the oximedia-ml crate — a typed
ML pipeline layer built atop the Pure-Rust OxiONNX
runtime. Inference is entirely opt-in; the default oximedia build still
pulls in zero ONNX symbols and stays C/Fortran-free.
| Pipeline | Feature | I/O | Reference model |
|---|---|---|---|
SceneClassifier |
scene-classifier |
224×224 RGB → Vec<SceneClassification> |
Places365 / ResNet |
ShotBoundaryDetector |
shot-boundary |
48×27 RGB window → Vec<ShotBoundary> |
TransNet V2 |
AestheticScorer |
aesthetic-score |
224×224 RGB → AestheticScore |
NIMA |
ObjectDetector |
object-detector |
640×640 RGB → Vec<Detection> (NMS) |
YOLOv8 (80 COCO) |
FaceEmbedder |
face-embedder |
112×112 RGB face → 512-dim FaceEmbedding |
ArcFace |
[dependencies]
oximedia = { version = "0.1.8", features = ["ml", "ml-scene-classifier", "ml-onnx"] }
```rust,ignore use oximedia::ml::pipelines::{SceneClassifier, SceneImage}; use oximedia::ml::{DeviceType, TypedPipeline};
let classifier = SceneClassifier::load("places365.onnx", DeviceType::auto())?; let image = SceneImage::new(rgb_bytes, 224, 224)?; for pred in classifier.run(image)? { println!("class {} -> {:.3}", pred.class_index, pred.score); }
### Device selection
`DeviceType::auto()` probes the strongest available backend once and
memoises the result: **CUDA → DirectML → WebGPU → CPU**. Each backend is a
feature flag (`cuda`, `directml`, `webgpu`); CPU is always available.
`cuda` is native-only; every other backend — including the default CPU path
— compiles on `wasm32-unknown-unknown`.
### CLI
The `oximedia ml` namespace ships three subcommands (honour `--json` for
machine-readable output):
```bash
oximedia ml list # enumerate built-in pipelines + model zoo
oximedia ml probe # report GPU backend availability
oximedia ml run --pipeline scene-classifier \
--model places365.onnx \
--input frame.png \
--device auto \
--top-k 5 \
--dry-run
Several domain crates gain an onnx feature for an ML-backed fast path
while keeping the Pure-Rust default intact: oximedia-scene
(MlSceneEnricher), oximedia-shots (MlShotDetector),
oximedia-caption-gen (CaptionEncoder), oximedia-recommend
(EmbeddingExtractor), oximedia-mir (MusicTagger).
See docs/ml_guide.md for the full feature matrix,
per-pipeline I/O contracts, device selection details, WASM support
matrix, and roadmap.
Active cycle — latest release 2026-06-02. Theme: Codec completeness, audio restoration, algorithmic depth, and entropy coding improvements.
oximedia-audio): Real SILK encoder path with noise-shaped quantisation loop; 440 Hz sine round-trip SNR ≥ 6 dB verified.oximedia-codec): CoeffBuffer::pos_to_rowcol now correctly handles non-square transform blocks, fixing a symbol-vs-position bug in AV1 entropy decoding EOB CDF paths.oximedia-aaf): Full SMPTE ST 377-1 CFB + KLV binary serializer; 22 previously orphan AAF modules registered and wired into the workspace.oximedia-ndi): Real Huffman entropy coding for NDI SpeedHQ streams; 22 NDI orphan modules registered and wired.oximedia-drm): Pure-Rust software TPM 2.0 emulator and Secure Enclave emulator — enables DRM key protection on platforms without hardware TPM/SE.oximedia-restore): Three new audio restoration algorithms: AR-LPC-based declicker, Boll 1979 spectral subtraction noise reducer, and a parametric Wiener filter denoiser.oximedia-bench): Y4M (YUV4MPEG2) container reader/writer and full ITU-T P.910 Spatial Information, Temporal Information, and motion activity metrics.oximedia-server): S3 multipart upload with per-part retry logic and configurable upload parallelism for high-throughput media ingest.oximedia-clips): Clip waveform extraction now uses the real demuxer path for FLAC, Opus, MP3, and Vorbis — replacing stub silence.SrtListener::accept (oximedia-net): SRT ingest now calls the real SrtListener::accept instead of the previous no-op stub, enabling live SRT stream ingestion.oximedia-ml, oximedia-caption-gen): AutoCaption example updated to current API; ML pipeline feature flags and ONNX runtime wiring improved across the workspace.oximedia-analysis): Configurable downscaling (Full/Half/Quarter) for the analysis pipeline; box-filter downsample; 5 new tests.oximedia-align): phase_correlate_1d now uses oxifft::rfft/irfft (N/2+1 bins, half the complex ops) matching the OxiFFT policy; 4 regression tests.oximedia-archive-pro): DataCite DOI metadata generation, PBCore metadata crosswalk, and automated format migration triggers; 18 new tests.oximedia-proxy): Batch EDL conforming with merge strategies, proxy database export/import with root-prefix rebase; 9 new tests.oximedia-convert): Keyframe-boundary segment plan with rayon-parallel encode; codec-agnostic concat; 5 new tests.oximedia-scaling): Cache-blocked tiled scaling (bit-exact vs reference), rayon par_iter over tiles; 7 new tests.oximedia-access): Real speech DSP (4th-order Butterworth 300–3400 Hz, downward DRC, peaking boost) and AVX2/NEON SIMD contrast enhancement with 256-entry gamma LUT.oximedia-codec): SILK LTP coarse-to-fine decimated pitch search, per-subframe contour RD, fractional-lag refinement, round-trip harness.cargo nextest run --workspace --all-features).Released 2026-04-21. Theme: Full ONNX Runtime integration via the Pure-Rust OxiONNX stack (previously slated for 0.3.0). All inference is feature-gated; the pure-Rust default build stays C/Fortran-free.
oxionnx, oxionnx-ops, oxionnx-gpu, oxionnx-directml, oxionnx-proto) instead of the C++ ort runtime — preserves the COOLJAPAN Pure-Rust Policy.oximedia-ml facade crate: Central ML layer exposing OnnxModel, ModelCache (concurrent LRU model cache with ~/.cache/oximedia/models/), TypedPipeline<In, Out> trait, DeviceType::auto() runtime probe, ImagePreprocessor (ImageNet normalize + letterbox + NCHW), and ModelZoo registry.SceneClassifier (ImageNet-style top-K classifier with softmax/argsort postprocessing) and ShotBoundaryDetector (TransNetV2-compatible sliding window with many-hot hard/soft cut outputs) — more pipelines (AutoCaption, AestheticScore, ObjectDetector, FaceEmbedder) queued for Wave 2.ml feature: oximedia::ml module and prelude re-exports gated behind ml (off by default). Sub-features ml-scene-classifier, ml-shot-boundary, ml-onnx for granular opt-in; full feature picks them all up.oximedia-ml: Covers preprocessing, cache eviction, pipeline contracts, and ModelInfo round-trips. Zero clippy warnings. Pure-Rust default build verified — no ONNX symbols linked unless onnx feature is enabled.Released 2026-04-20.
oximedia-avi crate — pure-Rust AVI muxer and demuxer targeting MJPEG-only streams up to 1 GB (RIFF list size constraint).Iterator-based decoder for low-memory playback.oximedia-cli now accepts -c:v mjpeg and -c:v apv on all transcode/convert commands.oximedia-codec, oximedia-container, oximedia-audio, oximedia-convert, oximedia-graphics) confirmed clean under wasm32-unknown-unknown.FFmpeg domain spans
$ claude mcp add oximedia \
-- python -m otcore.mcp_server <graph>