DoenaSoft.MediaInfoHelper
3.3.0
dotnet add package DoenaSoft.MediaInfoHelper --version 3.3.0
NuGet\Install-Package DoenaSoft.MediaInfoHelper -Version 3.3.0
<PackageReference Include="DoenaSoft.MediaInfoHelper" Version="3.3.0" />
<PackageVersion Include="DoenaSoft.MediaInfoHelper" Version="3.3.0" />
<PackageReference Include="DoenaSoft.MediaInfoHelper" />
paket add DoenaSoft.MediaInfoHelper --version 3.3.0
#r "nuget: DoenaSoft.MediaInfoHelper, 3.3.0"
#:package DoenaSoft.MediaInfoHelper@3.3.0
#addin nuget:?package=DoenaSoft.MediaInfoHelper&version=3.3.0
#tool nuget:?package=DoenaSoft.MediaInfoHelper&version=3.3.0
MediaInfoHelper
A .NET library to query audio and video files for their metadata information.
Description
DoenaSoft.MediaInfoHelper is a comprehensive library that provides easy access to metadata from various media file formats including video files and audio books. It wraps popular media information libraries and provides a unified interface for extracting technical details and metadata from media files.
Features
- Read video file metadata (duration, resolution, codec, etc.)
- Extract audio book information (chapters, duration, tags)
- Support for multiple media formats
- Built on top of proven libraries:
- FFProbe (via NReco.VideoInfo)
- NAudio for audio file analysis
- TagLib for tag reading
- Simple and intuitive API
- Strongly-typed data objects for media information
- Customizable language standardization and weighting
- Configurable subtitle file format detection
Installation
Install via NuGet Package Manager:
Install-Package DoenaSoft.MediaInfoHelper
Or via .NET CLI:
dotnet add package DoenaSoft.MediaInfoHelper
Requirements
- .NET Framework 4.7.2 or higher
Usage
Reading Video File Information
using DoenaSoft.MediaInfoHelper.DataObjects;
using DoenaSoft.MediaInfoHelper.Readers;
// Create a media file object
var mediaFile = new MediaFile { FileName = @"C:\path\to\video.mp4" };
// Create a video reader
var videoReader = new VideoReader(mediaFile);
// Determine the length of the video
videoReader.DetermineLength();
// Access the length
uint durationInSeconds = mediaFile.Length;
Reading Audio Book Information
using DoenaSoft.MediaInfoHelper.Readers;
// Create an audio book reader
var audioBookReader = new AudioBookReader();
// Get total length of audio files in a directory
var directoryInfo = new DirectoryInfo(@"C:\path\to\audiobook");
var totalLength = audioBookReader.GetLength(directoryInfo);
Console.WriteLine($"Hours: {totalLength.Hours}");
Console.WriteLine($"Minutes: {totalLength.Minutes}");
Console.WriteLine($"Seconds: {totalLength.Seconds}");
Customizing Language Handling
using DoenaSoft.MediaInfoHelper.Helpers;
// Implement your own language provider
public class CustomLanguageProvider : ILanguageProvider
{
public string StandardizeLanguage(string language)
{
// Your custom language standardization logic
return language?.ToLower();
}
public int GetLanguageWeight(string language)
{
// Your custom language priority (lower = higher priority)
return 100;
}
}
// Configure at application startup
MediaInfoConfiguration.LanguageProvider = new CustomLanguageProvider();
Customizing Subtitle Format Detection
using DoenaSoft.MediaInfoHelper.Helpers;
// Implement your own subtitle extension provider
public class CustomSubtitleProvider : ISubtitleExtensionProvider
{
public IEnumerable<string> GetSubtitleExtensions()
{
// Return the subtitle formats you want to support
return new[] { "srt", "vtt", "ass" };
}
}
// Configure at application startup
MediaInfoConfiguration.SubtitleExtensionProvider = new CustomSubtitleProvider();
Customization
Language Provider
The library includes a default language provider that standardizes common language codes:
- German (de, deu, ger → de)
- English (en, eng → en)
- Arabic (ar, ara → ar)
- Spanish (es, spa → es)
- Japanese (ja, jap, jpn → ja)
- Korean (ko, kor → ko)
You can implement ILanguageProvider to define your own language handling logic.
Subtitle Extension Provider
The library includes a default subtitle extension provider that supports:
- srt (SubRip Text)
- sub (MicroDVD / Sub Station Alpha)
- sup (Blu-ray PGS)
- idx (VobSub index)
- ass (Advanced SubStation Alpha)
- ssa (Sub Station Alpha)
- vtt (WebVTT)
You can implement ISubtitleExtensionProvider to customize which subtitle formats are detected.
For detailed documentation on customization, see:
- LANGUAGE_CUSTOMIZATION.md
- SUBTITLE_CUSTOMIZATION.md
- LANGUAGE_PROVIDER_QUICKREF.md
Data Objects
The library provides strongly-typed classes for different types of media:
MediaFile- General media file informationVideoMeta- Video-specific metadataAudioBookMeta- Audio book metadata including chapters and rolesFFProbeMeta- Raw FFProbe output dataTimeParts- Time duration broken into hours, minutes, seconds
Dependencies
- DoenaSoft.ToolBox
- NReco.VideoInfo (FFProbe wrapper)
- NAudio (Audio file processing)
- TagLib (Metadata tag reading)
License
This project is licensed under the MIT License.
Author
DJ Doena Doena Soft.
Repository
https://github.com/DJDoena/MediaInfoHelper
Support
For issues, questions, or contributions, please visit the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- DoenaSoft.ToolBox (>= 3.0.4)
- NAudio (>= 2.3.0)
- NReco.VideoInfo (>= 1.2.1)
- taglib (>= 2.1.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on DoenaSoft.MediaInfoHelper:
| Package | Downloads |
|---|---|
|
DoenaSoft.CopySeries.Xml
XML schemas for handling CopySeries |
|
|
DoenaSoft.WatchHistory.Xml
XML schemas for handling WatchHistory |
|
|
DoenaSoft.CalculateAudioBookRunningTimes
A library for extracting and calculating audiobook metadata including running times, chapters, authors, and narrators. Supports MP3 and MP4 audiobook formats with customizable interaction handling. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.3.0 | 86 | 4/23/2026 |
| 3.2.3 | 112 | 4/17/2026 |
| 3.2.2 | 103 | 4/17/2026 |
| 3.2.1 | 81 | 4/17/2026 |
| 3.2.0 | 104 | 4/17/2026 |
| 3.1.12 | 161 | 3/30/2026 |
| 3.1.11 | 118 | 3/29/2026 |
| 3.1.10 | 128 | 2/14/2026 |
| 3.1.9 | 473 | 12/10/2025 |
| 3.1.8 | 234 | 11/26/2025 |
| 3.1.7 | 322 | 4/20/2025 |
| 3.1.6 | 274 | 9/28/2024 |
| 3.1.5 | 381 | 12/5/2023 |
| 3.1.4 | 223 | 12/5/2023 |
| 3.1.3 | 244 | 12/3/2023 |
| 3.1.2 | 248 | 10/6/2023 |
| 3.1.1 | 352 | 9/12/2023 |
| 3.1.0 | 286 | 8/28/2023 |
| 3.0.6 | 417 | 8/27/2023 |
| 3.0.5 | 361 | 8/25/2023 |