![]() |
VOOZH | about |
dotnet add package MediaInfo.Wrapper.Core --version 26.1.0
NuGet\Install-Package MediaInfo.Wrapper.Core -Version 26.1.0
<PackageReference Include="MediaInfo.Wrapper.Core" Version="26.1.0" />
<PackageVersion Include="MediaInfo.Wrapper.Core" Version="26.1.0" />Directory.Packages.props
<PackageReference Include="MediaInfo.Wrapper.Core" />Project file
paket add MediaInfo.Wrapper.Core --version 26.1.0
#r "nuget: MediaInfo.Wrapper.Core, 26.1.0"
#:package MediaInfo.Wrapper.Core@26.1.0
#addin nuget:?package=MediaInfo.Wrapper.Core&version=26.1.0Install as a Cake Addin
#tool nuget:?package=MediaInfo.Wrapper.Core&version=26.1.0Install as a Cake Tool
MP-MediaInfo is .NET wrapper for MediaArea MediaInfo and use native packages 👁 NuGet Badge
and 👁 NuGet Badge
.
👁 License
👁 Build Core
👁 Build
| Framework | Package |
|---|---|
| .NET Framework 4.0 | 👁 NuGet Badge |
| .NET Framework 4.5 | 👁 NuGet Badge |
| .NET Standard 2.1 | 👁 NuGet Badge |
| .NET 6.0 | 👁 NuGet Badge |
| .NET 8.0 | 👁 NuGet Badge |
| .NET 10.0 | 👁 NuGet Badge |
Two packages are available:
Choose based on your target framework:
dotnet add package MediaInfo.Wrapper.Core --version 26.1.0
Install-Package MediaInfo.Wrapper -Version 26.1.0
Add to usings:
using MediaInfo;
Instantiate a MediaInfoWrapper with the path to your media file:
var media = new MediaInfoWrapper("path/to/media/file.mp4");
Always verify the file was successfully analyzed:
if (media.Success)
{
// File analyzed successfully
}
else
{
// Handle analysis failure
Console.WriteLine("Failed to analyze media file");
}
Access basic media information:
var containerFormat = media.Format; // e.g., "MPEG-4"
var duration = media.Duration; // Duration in milliseconds
var overallBitRate = media.OverallBitRate; // Combined bitrate of all streams
var isScanningNeeded = media.ScanningNeeded; // Whether file needs deeper analysis
Extract detailed video information:
if (media.HasVideo)
{
var videoStream = media.VideoStreams.FirstOrDefault();
if (videoStream != null)
{
var width = videoStream.Width; // Resolution width
var height = videoStream.Height; // Resolution height
var codec = videoStream.Codec; // e.g., "AVC"
var frameRate = videoStream.FrameRate; // Frames per second
var frameRateMode = videoStream.FrameRateMode; // e.g., CFR, VFR
var bitRate = videoStream.BitRate; // Video stream bitrate
var standard = videoStream.Standard; // e.g., "NTSC", "PAL"
var aspectRatio = videoStream.AspectRatio; // e.g., "16:9"
var chromaSubSampling = videoStream.ChromaSubSampling; // e.g., "4:2:0"
var colorSpace = videoStream.ColorSpace; // e.g., "YUV"
var hdrFormat = videoStream.Hdr; // e.g., "HDR10", "Dolby Vision"
var profile = videoStream.Profile; // Codec profile
var level = videoStream.Level; // Profile level
}
}
Access audio track information:
foreach (var audioStream in media.AudioStreams)
{
var language = audioStream.Language; // ISO 639-2 language code
var codec = audioStream.Codec; // e.g., "AAC", "AC-3"
var bitRate = audioStream.BitRate; // Audio bitrate
var channels = audioStream.Channels; // Number of audio channels
var channelLayout = audioStream.ChannelLayout; // e.g., "L R C LFE Ls Rs"
var samplingRate = audioStream.SamplingRate; // Sample rate in Hz
var bitDepth = audioStream.BitDepth; // Bits per sample
var bitrateMode = audioStream.BitrateMode; // CBR, VBR, etc.
var title = audioStream.Title; // Track title if available
}
Retrieve subtitle information:
foreach (var subtitleStream in media.SubtitleStreams)
{
var codec = subtitleStream.Codec; // e.g., "PGS", "ASS"
var language = subtitleStream.Language; // ISO 639-2 language code
var title = subtitleStream.Title; // Subtitle track name
}
Extract metadata:
var audioTags = media.AudioTags; // Audio metadata (album, artist, etc.)
var videoTags = media.VideoTags; // Video metadata (title, description, etc.)
var generalInfo = media.GeneralTags; // File-level metadata
if (audioTags != null)
{
var artist = audioTags.Performer;
var album = audioTags.Album;
var title = audioTags.Title;
}
Access chapter/menu information:
foreach (var chapter in media.ChapterStreams)
{
var startTime = chapter.StartTime; // Chapter start timestamp
// Chapter stream information available
}
Optionally provide a logger to track analysis:
public class ConsoleLogger : ILogger
{
public void Log(string message) => Console.WriteLine(message);
}
var logger = new ConsoleLogger();
var media = new MediaInfoWrapper("path/to/file.mp4", logger);
MP-MediaInfo supports analysis of virtually all media formats supported by the underlying MediaInfo library, including:
Video Formats: MP4, MKV, AVI, MOV, FLV, WebM, WMV, 3GP, and many more
Audio Codecs: H.264/AVC, H.265/HEVC, MPEG-4, VP8, VP9, AV1, Theora, and others
Audio Formats: MP3, AAC, FLAC, Opus, Vorbis, AC-3, DTS, TrueHD, Atmos, and more
Subtitle Formats: PGS, ASS/SSA, SRT, SUBRIP, DVB, and other subtitle types
For a complete and detailed list, refer to the MediaInfo documentation.
Handle potential errors gracefully:
try
{
var media = new MediaInfoWrapper(filePath);
if (!media.Success)
{
Console.WriteLine("Analysis was not successful");
return;
}
// Process media information
}
catch (FileNotFoundException)
{
Console.WriteLine("Media file not found");
}
catch (Exception ex)
{
Console.WriteLine($"Error analyzing media: {ex.Message}");
}
Analyze multiple files efficiently:
var mediaFiles = Directory.GetFiles("mediaFolder", "*.mp4");
foreach (var file in mediaFiles)
{
try
{
var media = new MediaInfoWrapper(file);
if (media.Success)
{
Console.WriteLine($"{Path.GetFileName(file)}: {media.Format}");
// Process each file
}
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {file}: {ex.Message}");
}
}
var media = new MediaInfoWrapper(filePath);
// Check if file has video
if (media.HasVideo)
{
var videoStream = media.VideoStreams.FirstOrDefault();
if (videoStream?.Hdr != null)
{
Console.WriteLine($"HDR Format: {videoStream.Hdr}");
}
}
// Check number of audio tracks
Console.WriteLine($"Audio tracks: {media.AudioStreams.Count}");
// Find specific audio codec
var ac3Tracks = media.AudioStreams
.Where(s => s.Codec?.Contains("AC-3") ?? false)
.ToList();
Windows: The native MediaInfo libraries are included in the NuGet package. No additional installation needed.
Linux/macOS: Install system dependencies as described in the Dependencies section.
Some media files may require deeper scanning. Check media.ScanningNeeded:
if (media.ScanningNeeded)
{
Console.WriteLine("File may benefit from deeper analysis");
// Files with streaming headers might have incomplete information
}
When processing very large files or many files in parallel, be mindful of memory usage. Consider disposing of MediaInfoWrapper objects when done:
using (var media = new MediaInfoWrapper(filePath))
{
// Use media
}
// Disposed automatically
ASP.NET Core demo application is available which shows the usage of the package, serialization and running from the docker container. Code from this demo should not be used in production code, the code is merely to demonstrate the usage of this package.
Make sure that the following dependencies are installed in the operating system before starting the project
.NET Core package supports next operating systems
| Operation system | Version |
|---|---|
| MacOS | 10.15 (Catalina), 11 (Big Sur) |
| Ubuntu | 16.04, 18.04, 20.04 and 21.04 |
| CenOS | 7 and above |
| Fedora | 32 and above |
| OpenSUSE | 15.2 and Tumbleweed |
| RedHat | 7 and above |
| Debian | 9 and above |
| Arch Linux | |
| Windows | 7 and above |
| Docker | buster |
Some dependencies are available with MacPorts. To install MacPorts: https://guide.macports.org/#installing
port install zlib curl zenlib
sudo apt-get update
sudo apt-get install libzen0v5 libmms0 zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0-dev
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y update
sudo yum -y install zlib curl libzen bzip2 libcurl
sudo rpm -ivh https://download1.rpmfusion.org/free/el/updates/7/x86_64/l/libmms-0.6.4-2.el7.x86_64.rpm
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y update
sudo yum -y install zlib curl libzen bzip2 libcurl
sudo rpm -ivh https://download1.rpmfusion.org/free/el/updates/8/x86_64/l/libmms-0.6.4-8.el8.x86_64.rpm
sudo dnf update
sudo dnf -y install zlib curl libzen openssl libmms
sudo zypper refresh
sudo zypper update -y
sudo zypper install -y zlib curl libmms0 openssl libnghttp2-14
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y update
sudo yum -y install zlib curl libzen bzip2 libcurl
sudo rpm -ivh https://download1.rpmfusion.org/free/el/updates/7/x86_64/l/libmms-0.6.4-2.el7.x86_64.rpm
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y update
sudo yum -y install zlib curl libzen bzip2 libcurl
sudo rpm -ivh https://download1.rpmfusion.org/free/el/updates/8/x86_64/l/libmms-0.6.4-8.el8.x86_64.rpm
sudo apt-get update
sudo apt-get install libzen0v5 libmms0 openssl zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0
Windows package contains all dependencies and does not required any actions.
sudo pacman -Syu
sudo pacman -S libcurl-gnutls libzen libmms libssh librtmp0
FROM mcr.microsoft.com/dotnet/aspnet:3.1
RUN apt-get update && apt-get install -y libzen0v5 libmms0 openssl zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0
FROM mcr.microsoft.com/dotnet/aspnet:6.0
RUN apt-get update && apt-get install -y libzen0v5 libmms0 openssl zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN apt-get update && apt-get install -y libzen0v5 libmms0 openssl zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0
FROM mcr.microsoft.com/dotnet/aspnet:10.0
RUN apt-get update && apt-get install -y libzen0v5 libmms0 openssl zlib1g zlibc libnghttp2-14 librtmp1 curl libcurl4-gnutls-dev libglib2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on MediaInfo.Wrapper.Core:
| Package | Downloads |
|---|---|
|
Zen.Media
Media handling for Zen |
|
|
Fly.Toolkit.Wpf
请无视它,它并不好用,只是能给我自己带来一点点的便利而已 |
|
|
RnCore.MediaInfoAbstractions
Abstractions for MediaInfo |
Showing the top 3 popular GitHub repositories that depend on MediaInfo.Wrapper.Core:
| Repository | Stars |
|---|---|
|
TV-Rename/tvrename
Organise your TV & Movie videos with ease
|
|
|
CnGal/CnGalWebSite
CnGal是一个非营利性的,立志于收集整理国内制作组创作的中文Galgame/AVG的介绍、攻略、评测、感想等内容的资料性质的网站。
|
|
|
qian-o/MediaWPF
WPF 视频硬解码渲染Demo
|
| Version | Downloads | Last Updated |
|---|---|---|
| 26.1.0 | 10,400 | 3/24/2026 |
| 21.9.3 | 479,277 | 9/29/2022 |
| 21.9.2 | 120,603 | 10/13/2021 |
| 21.9.1 | 2,369 | 9/30/2021 |
| 21.9.0 | 612 | 9/29/2021 |
| 21.3.7 | 1,640 | 9/26/2021 |
| 21.3.6 | 1,115 | 9/19/2021 |
| 21.3.5 | 4,099 | 8/24/2021 |
| 21.3.4 | 5,541 | 6/30/2021 |
| 21.3.3 | 2,343 | 5/23/2021 |
| 21.3.2 | 957 | 5/18/2021 |
| 21.3.1 | 2,881 | 3/31/2021 |
| 21.3.0 | 663 | 3/29/2021 |
| 20.9.2 | 9,285 | 12/13/2020 |
| 20.9.0 | 803 | 12/10/2020 |
| 20.8.0 | 2,927 | 8/14/2020 |
| 19.9.4 | 7,508 | 6/21/2020 |
| 19.9.3 | 828 | 6/20/2020 |
| 19.9.2 | 2,519 | 3/17/2020 |
Copyright © 2017-2026 Yaroslav Tatarenko
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.