ModelingEvolution.Mjpeg 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ModelingEvolution.Mjpeg --version 1.0.0
                    
NuGet\Install-Package ModelingEvolution.Mjpeg -Version 1.0.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="ModelingEvolution.Mjpeg" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ModelingEvolution.Mjpeg" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ModelingEvolution.Mjpeg" />
                    
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 ModelingEvolution.Mjpeg --version 1.0.0
                    
#r "nuget: ModelingEvolution.Mjpeg, 1.0.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 ModelingEvolution.Mjpeg@1.0.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=ModelingEvolution.Mjpeg&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ModelingEvolution.Mjpeg&version=1.0.0
                    
Install as a Cake Tool

ModelingEvolution.Mjpeg

A .NET library for MJPEG stream processing with JPEG boundary detection, dimension extraction, and frame indexing utilities.

Installation

dotnet add package ModelingEvolution.Mjpeg

Features

  • JPEG Boundary Detection - State machine-based detection of JPEG frame boundaries (SOI/EOI markers)
  • Dimension Extraction - Extract width/height from JPEG SOF0/SOF2 markers
  • Bidirectional Scanning - Forward and reverse MJPEG decoders for flexible stream processing
  • Frame Validation - Validate JPEG frame integrity

Usage

Detecting JPEG Frames in MJPEG Stream

using ModelingEvolution.Mjpeg;

var decoder = new MjpegDecoder();

foreach (var b in mjpegBytes)
{
    var marker = decoder.Decode(b);

    switch (marker)
    {
        case JpegMarker.Start:
            // Frame started at current position - 1
            break;
        case JpegMarker.End:
            // Frame ended at current position
            break;
    }
}

Extracting JPEG Dimensions

using ModelingEvolution.Mjpeg;

byte[] jpegData = /* your JPEG frame */;
var (width, height) = JpegDimensionExtractor.Extract(jpegData);

Console.WriteLine($"Image size: {width}x{height}");

Validating JPEG Frame

using ModelingEvolution.Mjpeg;

Memory<byte> frame = /* your frame data */;
bool isValid = MjpegDecoder.IsJpeg(frame);

Reverse Scanning (for seeking from end)

using ModelingEvolution.Mjpeg;

var decoder = new ReverseMjpegDecoder();

// Scan bytes in reverse order
for (int i = mjpegBytes.Length - 1; i >= 0; i--)
{
    var marker = decoder.Decode(mjpegBytes[i]);
    // ...
}

JPEG Markers Reference

Marker Bytes Description
SOI 0xFF 0xD8 Start Of Image
EOI 0xFF 0xD9 End Of Image
SOF0 0xFF 0xC0 Start Of Frame (Baseline)
SOF2 0xFF 0xC2 Start Of Frame (Progressive)

License

MIT License - see LICENSE for details.

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.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.3 41 1/18/2026
1.1.7 41 1/18/2026
1.1.6 42 1/18/2026
1.1.5 34 1/17/2026
1.1.4 31 1/17/2026
1.1.3 34 1/17/2026
1.1.2 35 1/17/2026
1.1.1 40 1/17/2026
1.0.0 39 1/17/2026