MediaLens 0.1.0-rc.1

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

Showing the top 1 NuGet packages that depend on MediaLens:

Package Downloads
MediaLens.DependencyInjection

Dependency injection setup for MediaLens, a .NET wrapper for MediaLens.Native to inspect media files and retrieve metadata.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-rc.1 35 4/7/2026