ManagedCodecs.Containers 0.7.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ManagedCodecs.Containers --version 0.7.0
                    
NuGet\Install-Package ManagedCodecs.Containers -Version 0.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedCodecs.Containers" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ManagedCodecs.Containers" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="ManagedCodecs.Containers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ManagedCodecs.Containers --version 0.7.0
                    
#r "nuget: ManagedCodecs.Containers, 0.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ManagedCodecs.Containers@0.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ManagedCodecs.Containers&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=ManagedCodecs.Containers&version=0.7.0
                    
Install as a Cake Tool

ManagedCodecs

Pure managed C# media decoders: no native binaries, Native AOT friendly, and running on WebAssembly too. Every decoder is checked against FFmpeg sample by sample.

  • H.264: Constrained Baseline to High 4:4:4 Predictive. CAVLC and CABAC, I/P/B, interlaced (MBAFF and field pictures), 4:0:0 to 4:4:4, 8 to 14 bits, lossless; bit-exact with FFmpeg. Frame threading and error concealment on request.
  • MJPEG: baseline and extended Huffman JPEG, interlaced AVI1; bit-exact with FFmpeg.
  • AAC LC and HE-AAC (SBR, parametric stereo): mono to 7.1, within 2^-17 of FFmpeg's float output for AAC LC.
  • Containers: AVI, MP4 (fragmented files and edit lists too) and raw AAC (ADTS), packets and timestamps as FFmpeg's demuxers give them.

The packages: ManagedCodecs for everything, or one of ManagedCodecs.Containers, ManagedCodecs.Mjpeg, ManagedCodecs.H264 and ManagedCodecs.Aac, each with ManagedCodecs.Core. They share internals, so each depends on the others at exactly its own version.

Decoding a file

Packets go in in decode order; frames come out in display order, each with the Pts of its packet. Decode returns zero or more frames (H.264 can hold frames back for reordering) and Flush the rest:

using ManagedCodecs;
using ManagedCodecs.Containers;
using ManagedCodecs.H264;
using ManagedCodecs.Mjpeg;

using var demuxer = Demuxer.Open("video.mp4");
var video = demuxer.Video!;
IVideoDecoder decoder = video.Codec == CodecIds.H264 ? new H264Decoder(video) : new MjpegDecoder(video);

foreach (var packet in demuxer.ReadPackets().Where(p => p.StreamIndex == video.StreamIndex))
{
    foreach (var frame in decoder.Decode(packet))
    {
        Show(frame); // frame.Pts is in video.TimeBase; frame.GetRow(plane, y) reads its samples
    }
}

foreach (var frame in decoder.Flush())
{
    Show(frame);
}

Publishing with Native AOT on x64: set <IlcInstructionSet>x86-64-v3</IlcInstructionSet> (AVX2) in the app, or the 256-bit paths are left out and AAC and HE-AAC take about a third longer (README, Native AOT).

Audio goes the same way: new AacDecoder(demuxer.Audio!) returns an AudioFrame of float samples per packet. Every decoder and demuxer also has an async API (ReadPacketsAsync, DecodeAsync, FlushAsync).

More

The repository has the full documentation: the README (the API in detail, threading, malformed input, WebAssembly, speed against FFmpeg), what each feature is checked against, and the changelog.

MIT licensed; the package carries THIRD-PARTY-NOTICES.md, the notices of the projects some constant tables were transcribed from. The license covers the code, not the formats: codec patents (H.264, AAC) apply regardless of the language a decoder is written in.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ManagedCodecs.Containers:

Package Downloads
ManagedCodecs

Pure managed C# media codecs, every package at once: MJPEG and H.264 (bit-exact with FFmpeg), AAC and HE-AAC, AVI, MP4 and ADTS demuxing. No native binaries, Native AOT friendly.

ManagedCodecs.Thumbnails

Thumbnails (PNG, JPEG or RGBA) and the basic facts (duration, displayed size, codecs, rotation) of a video file without FFmpeg, in pure managed C#, for web back ends, serverless functions and WebAssembly.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0 0 11/4/2026
0.7.0 188 11/2/2026
0.6.0 153 11/1/2026
0.5.0 423 11/1/2026
0.4.0 609 10/30/2026
0.3.0 256 10/30/2026
0.2.5 137 10/30/2026
0.2.4 136 10/30/2026
0.2.3 188 10/29/2026
0.2.2 152 10/29/2026
0.2.1 130 10/29/2026
0.2.0 195 10/28/2026
0.1.0 510 10/27/2026
0.1.0-preview.3 62 10/27/2026
0.1.0-preview.2 53 10/26/2026
0.1.0-preview.1 60 10/26/2026