Recursive AI
LibraryC#AvailablePreview

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 through an adapter. A preview, 0.1.0-preview.1: it reads files and doesn’t write them yet, and the API can change.

dotnet add package RecursiveAI.OneMedia --prerelease

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
Program.csC#
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
What it does

What it does

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.

How it’s checked

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.

TaskCompared withx64arm64
MP4 demux, every packetSharpMP40.10× / 0.21×0.09× / 0.20×
MP4 audio track onlyOneAudio Mp4PacketSource0.53× / 0.82×0.49× / 0.61×
MP4 probe (tracks, duration)MetadataExtractor, TagLib#, ATL.NET0.10× / 0.40×0.12× / 0.28×
Matroska demuxMatroska (NEbml)0.26× / 0.31×0.25× / 0.41×
Matroska probeNEbml element reader0.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.

The packages

Go further

OneMedia is unaffiliated with other products or companies named OneMedia.