---
title: "onemedia"
url: https://recursiveai.org/onemedia/
description: "A media container reader for .NET in C#: MP4, MOV, 3GP and fragmented MP4, MKV and WebM. Tracks, packets, codec headers, tags, and capture time, location and rotation with their sources. It decodes nothing. A preview. MIT or Apache-2.0."
---

# onemedia

Read MP4, MOV and MKV/WebM files in C#: tracks, packets, codec headers and tags, and when, where and on what a video was recorded. Managed code with no dependency beyond .NET.

> **It decodes nothing.** OneMedia reads containers. It never decodes or encodes a video or audio sample, so it gives no frames or thumbnails; audio tracks can be decoded by [oneaudio](https://recursiveai.org/oneaudio/) through an adapter. A preview, 0.1.0-preview.1: it reads files and doesn’t write them yet, and the API can change.

```sh
dotnet add package RecursiveAI.OneMedia --prerelease
```

- [Getting started](https://recursiveai.org/onemedia/docs/getting-started/)
- [Docs](https://recursiveai.org/onemedia/docs/)
- [Cookbook](https://recursiveai.org/onemedia/cookbook/)
- [GitHub](https://github.com/recursive-ai-oss/onemedia-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneMedia)

## A quick look

One call opens an MP4 or a Matroska file by its content. Duration, codecs and tags come from the structure alone, and each capture fact lists every candidate the file holds, with where it came from.

[Getting started](https://recursiveai.org/onemedia/docs/getting-started/)

*Program.cs · C#*

```
using RecursiveAI.OneMedia;
 
using MediaFile media = Media.Open("clip.mov");
Console.WriteLine($"{media.Duration} {media.Video?.Codec}");
Console.WriteLine(media.Tags.Title);
foreach (var c in media.CaptureTime.Candidates)
    Console.WriteLine($"{c.Value} from {c.Source}");
Console.WriteLine(media.Location.Best?.Value);   // GPS, if any
```

### MP4, MOV and 3GP

MP4, MOV, 3GP/3G2, M4A/M4V and fragmented MP4: tracks, edit lists and every packet with exact timestamps, keyframe flags and its byte range in the file.

### Matroska and WebM

MKV, MKA, MK3D and WebM, seekable or live and forward-only: tracks, packets, tags with their targets, and attachments.

### Tags, one view

iTunes, QuickTime user data and keys, 3GPP, XMP and Matroska tags as stored, with a common view (title, artist, album, comment, date…) over all of them.

### When, where, what

Capture time, location, make, model, software and rotation, each as a ranked list of candidates with its source, raw value and time-zone certainty.

### Codec headers

H.264, HEVC, AV1, VP8/VP9, AAC, Opus, Vorbis, FLAC, AC-3 and more: profile, level, bit depth, color and the RFC 6381 codec string, from the headers alone.

### Big and remote files

Probing reads structure only, through files, streams or any ranged reader such as HTTP range requests. Packets are pulled with zero allocations per packet, in constant memory.

## Against ffprobe, ExifTool and MediaInfo, file by file

Packets against ffprobe 7.0.2: 121 MP4-family files with 744,306 packets and 92 Matroska and WebM files with 464,934 packets, 0 unexplained differences. Tags and facts agree with ExifTool 13.60 and MediaInfo 26.10 on 116 files, with every difference explained.

Probe and metadata I/O, local reads: a 4.38 GB MP4 with its index at the end takes 165,681 B in 34 reads, against 1,741,689 B in 32 reads for ffprobe and 23,628,223 B in 138 reads for MediaInfo. A 4.45 GB Matroska file takes 69,806 B in 20 reads.

Speed against the fastest managed library per task, as OneMedia’s time ÷ theirs (lower is faster), geometric mean / worst file. Every row meets the project’s bar (geometric mean at most 1.00×, no file above 1.25×) on both machines.

| Task | Compared with | x64 | arm64 |
|---|---|---|---|
| MP4 demux, every packet | SharpMP4 | 0.10× / 0.21× | 0.09× / 0.20× |
| MP4 audio track only | OneAudio `Mp4PacketSource` | 0.53× / 0.82× | 0.49× / 0.61× |
| MP4 probe (tracks, duration) | MetadataExtractor, TagLib#, ATL.NET | 0.10× / 0.40× | 0.12× / 0.28× |
| Matroska demux | Matroska (NEbml) | 0.26× / 0.31× | 0.25× / 0.41× |
| Matroska probe | NEbml element reader | 0.69× / 0.83× | 0.60× / 0.76× |

x64 is a Ryzen 9 7950X3D, arm64 an Apple M2; steady state. Every parser is fuzzed, and damaged input is reported as typed defects with byte offsets.

- [MP4 differences](https://recursiveai.org/onemedia/docs/isobmff/)
- [Matroska differences](https://recursiveai.org/onemedia/docs/matroska-differential/)
- [Tag comparison](https://recursiveai.org/onemedia/docs/tags/)
- [Benchmarks](https://recursiveai.org/onemedia/docs/bench/)

## The packages

- **OneMedia**: `RecursiveAI.OneMedia`: everything on this page, in one package that depends only on .NET. Preview, 0.1.0-preview.1.
- **Audio**: `RecursiveAI.OneMedia.Audio`: hands audio tracks to OneAudio, which decodes AAC, Opus, Vorbis, FLAC, MP3 and AMR. Preview, 0.1.0-preview.1.
- **Tool**: `RecursiveAI.OneMedia.Tool`: the `onemedia info` command, as text or JSON. Preview, 0.1.0-preview.1.
- **Not yet**: Writing, tag editing, remuxing, subtitles, repair, HLS/DASH packaging and other containers.
- **.NET**: .NET 10, C#; NativeAOT, trimming and browser WebAssembly clean. Written from the published specifications; other tools are only compared against as programs. MIT or Apache-2.0.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/onemedia-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneMedia)
- [Getting started](https://recursiveai.org/onemedia/docs/getting-started/)
- [All docs](https://recursiveai.org/onemedia/docs/)
- [Cookbook](https://recursiveai.org/onemedia/cookbook/)
- [Video duration and codec in C#](https://recursiveai.org/onemedia/cookbook/get-video-duration-resolution-codec/)
- [When and where a video was recorded](https://recursiveai.org/onemedia/cookbook/video-recording-date-location/)
- [MP4 metadata in C#](https://recursiveai.org/onemedia/cookbook/read-mp4-metadata/)
- [Changelog](https://github.com/recursive-ai-oss/onemedia-csharp/blob/v0.1.0-preview.1/CHANGELOG.md)

OneMedia is unaffiliated with other products or companies named OneMedia.
