oximedia-container
Container format mux/demux for the OxiMedia multimedia framework — MP4, MKV, MPEG-TS, OGG, and more.
Part of the oximedia workspace — a comprehensive pure-Rust media processing framework.
Overview
oximedia-container provides demuxers and muxers for media container formats:
| Format | Demux | Mux | Extensions |
|---|---|---|---|
| Matroska | Yes | Yes | .mkv |
| WebM | Yes | Yes | .webm |
| MPEG-TS | Yes | Yes | .ts, .m2ts |
| MP4 | Yes | — | .mp4 (AV1/VP9 only) |
| Ogg | Yes | — | .ogg, .opus, .oga |
| FLAC | Yes | — | .flac |
| WAV | Yes | — | .wav |
Features
- Format Detection — Automatic format probing from magic bytes
- Matroska/WebM — Full EBML parser, cluster management, cue points, chapters, attachments
- MPEG-TS — PES packet parsing, PAT/PMT tables, PCR/timing, DVB support
- MP4 — Atom-based parsing, edit lists, sample tables, timecode tracks, fragments (CMAF)
- Ogg — Page-based demuxing for Vorbis, Opus, FLAC, Theora
- Metadata — Tag editing for Vorbis comments, Matroska tags, MP4 metadata
- Streaming — Streaming demux and mux for live workflows
- Seeking — Keyframe-accurate seeking with cue/index structures
- Tracks — Multi-track management: video, audio, subtitle, data (GPS, telemetry)
- Chapters — Chapter list reading and writing (Matroska and MP4)
- Timecode — SMPTE timecode track support
Usage
Add to your Cargo.toml:
[]
= "0.1.3"
Format Detection
use probe_format;
let data = read?;
let result = probe_format?;
println!;
Demuxing
use ;
use FileSource;
let source = open.await?;
let mut demuxer = new;
demuxer.probe.await?;
for stream in demuxer.streams
while let Ok = demuxer.read_packet.await
Muxing
use ;
let config = new.with_title;
let mut muxer = new;
muxer.add_stream?;
muxer.add_stream?;
muxer.write_header.await?;
for packet in packets
muxer.write_trailer.await?;
Metadata Editing
use MetadataEditor;
let mut editor = open.await?;
if let Some = editor.get_text
editor.set;
editor.save.await?;
Key Types
| Type | Description |
|---|---|
ContainerFormat |
Enumeration of supported formats |
Packet |
Compressed media packet with timestamps |
PacketFlags |
Packet properties (keyframe, corrupt, etc.) |
StreamInfo |
Stream metadata (codec, dimensions, etc.) |
CodecParams |
Codec-specific parameters |
Demuxer |
Trait for container demuxers |
Muxer |
Trait for container muxers |
Module Structure (95 source files, 951 public items)
src/
├── lib.rs # Crate root
├── demux/
│ ├── matroska/ # EBML parser, Matroska/WebM demuxer
│ ├── mpegts/ # MPEG-TS packet, PES, PAT/PMT
│ ├── ogg/ # Ogg page demuxer
│ ├── flac/ # FLAC demuxer
│ ├── wav/ # WAV demuxer
│ └── mp4/ # MP4/MOV demuxer
├── mux/
│ ├── matroska/ # Matroska/WebM muxer (EBML writer, clusters, cues)
│ └── mpegts/ # MPEG-TS muxer (PES, PCR)
├── metadata/ # Tag editing (Vorbis, Matroska, MP4)
├── chapters/ # Chapter list handling
├── fragment/ # Fragmented MP4 / CMAF support
├── streaming/ # Streaming demux and mux
├── tracks/ # Multi-track management
├── seek/ # Seeking infrastructure
├── timecode/ # SMPTE timecode track
├── data/ # Data tracks (GPS, telemetry, atoms)
├── edit/ # Edit list handling
└── cue/ # Cue point generation and optimization
Patent Policy
All supported codecs are royalty-free:
Supported: AV1, VP9, VP8, Theora, Opus, Vorbis, FLAC, PCM
Rejected: H.264, H.265, AAC, AC-3, DTS (returns PatentViolation error if detected)
Policy
- No unsafe code (
#![forbid(unsafe_code)]) - Apache-2.0 license
License
Apache-2.0 — Copyright 2024-2026 COOLJAPAN OU (Team Kitasan)