MediaLens 0.1.0-rc.1
dotnet add package MediaLens --version 0.1.0-rc.1
NuGet\Install-Package MediaLens -Version 0.1.0-rc.1
<PackageReference Include="MediaLens" Version="0.1.0-rc.1" />
<PackageVersion Include="MediaLens" Version="0.1.0-rc.1" />
<PackageReference Include="MediaLens" />
paket add MediaLens --version 0.1.0-rc.1
#r "nuget: MediaLens, 0.1.0-rc.1"
#:package MediaLens@0.1.0-rc.1
#addin nuget:?package=MediaLens&version=0.1.0-rc.1&prerelease
#tool nuget:?package=MediaLens&version=0.1.0-rc.1&prerelease
MediaLens
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
InspectAsyncAPI - 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:
MediaLensExceptionMediaLensOpenExceptionMediaLensHandleExceptionMediaLensNativeDependencyException
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 | Versions 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. |
-
net10.0
- MediaLens.Native (>= 0.1.0-rc.1)
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 |
See full release notes at: https://github.com/MichaelHochriegl/MediaLens/releases/tag/v0.1.0-rc.1