MediaLens.DependencyInjection 0.1.0-rc.2

This is a prerelease version of MediaLens.DependencyInjection.
dotnet add package MediaLens.DependencyInjection --version 0.1.0-rc.2
                    
NuGet\Install-Package MediaLens.DependencyInjection -Version 0.1.0-rc.2
                    
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="MediaLens.DependencyInjection" Version="0.1.0-rc.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MediaLens.DependencyInjection" Version="0.1.0-rc.2" />
                    
Directory.Packages.props
<PackageReference Include="MediaLens.DependencyInjection" />
                    
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 MediaLens.DependencyInjection --version 0.1.0-rc.2
                    
#r "nuget: MediaLens.DependencyInjection, 0.1.0-rc.2"
                    
#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 MediaLens.DependencyInjection@0.1.0-rc.2
                    
#: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=MediaLens.DependencyInjection&version=0.1.0-rc.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MediaLens.DependencyInjection&version=0.1.0-rc.2&prerelease
                    
Install as a Cake Tool

MediaLens

.NET NuGet License CI

MediaLens is a small .NET wrapper around the native MediaInfo library. It comes with the bundled native binaries for (by using MediaLens.Native):

  • Windows x64
  • Linux x64
  • macOS x64
  • macOS arm64

Features

  • async InspectAsync API
  • strongly typed metadata models
  • dependency injection support
  • native MediaInfo integration

Installation

dotnet add package MediaLens

If you want DI support:

dotnet add package MediaLens.DependencyInjection

Quick start

using MediaLens;

var mediaLens = new MediaLens.MediaLens();
var mediaInfo = await mediaLens.InspectAsync("media.mp4");

Console.WriteLine($"File: {mediaInfo.General.FileName}");
Console.WriteLine($"Format: {mediaInfo.General.Format}");
Console.WriteLine($"Duration: {mediaInfo.General.Duration}");

foreach (var video in mediaInfo.VideoTracks)
{
    Console.WriteLine($"Video: {video.Format} {video.Width}x{video.Height} {video.FrameRate}");
}

foreach (var audio in mediaInfo.AudioTracks)
{
    Console.WriteLine($"Audio: {audio.Format} {audio.Channels}ch {audio.Language}");
}

foreach (var text in mediaInfo.TextTracks)
{
    Console.WriteLine($"Subtitle: {text.Format} {text.Language}");
}

Dependency injection

using MediaLens.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMediaLens();

AddMediaLens() registers IMediaLens as a singleton by default.

You can also choose a different lifetime:

using MediaLens.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMediaLens(ServiceLifetime.Scoped);

Returned metadata

InspectAsync() returns a MediaInfo object with:

  • general file metadata
  • video track metadata
  • audio track metadata
  • text/subtitle track metadata

Error handling

Common exceptions include:

  • MediaLensException
  • MediaLensOpenException
  • MediaLensHandleException
  • MediaLensNativeDependencyException

Example

A minimal example is available under examples/.

License

  • Repository code: MIT (LICENSE)
  • MediaInfoLib: BSD-2-Clause (LICENSE.MediaInfo)

MediaInfo is used through the bundled native binaries from MediaLens.Native.

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

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
0.1.0-rc.2 64 7/22/2026
0.1.0-rc.1 84 4/7/2026