├── .github └── FUNDING.yml ├── .gitignore ├── Get-MediaInfo.psd1 ├── Get-MediaInfo.psm1 ├── GridView.png ├── MediaInfoSharp ├── AssemblyInfo.cs ├── MediaInfoSharp.cs ├── MediaInfoSharp.csproj └── MediaInfoSharp.sln ├── README.md ├── Release.ps1 └── Summary.jpg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | ko_fi: stax76 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 |  2 | MediaInfo.dll 3 | MediaInfoSharp.dll 4 | MediaInfoSharp.pdb 5 | MediaInfoSharp/.vs 6 | MediaInfoSharp/obj 7 | -------------------------------------------------------------------------------- /Get-MediaInfo.psd1: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | RootModule = 'Get-MediaInfo.psm1' 4 | ModuleVersion = '3.7' 5 | GUID = '86639e26-2698-42ec-b7f1-c66daca2eb78' 6 | Author = 'Frank Skare (stax76)' 7 | CompanyName = 'Frank Skare (stax76)' 8 | Copyright = '(C) 2020-2021 Frank Skare (stax76). All rights reserved.' 9 | Description = 'PowerShell MediaInfo solution' 10 | PowerShellVersion = '5.1' 11 | ProcessorArchitecture = 'Amd64' 12 | FunctionsToExport = @('Get-MediaInfo', 'Get-MediaInfoValue', 'Get-MediaInfoSummary') 13 | CmdletsToExport = @() 14 | VariablesToExport = '*' 15 | AliasesToExport = @('gmi', 'gmiv', 'gmis') 16 | 17 | PrivateData = @{ 18 | PSData = @{ 19 | Tags = @('mp3', 'media', 'video', 'audio') 20 | ProjectUri = 'https://github.com/stax76/Get-MediaInfo' 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Get-MediaInfo.psm1: -------------------------------------------------------------------------------- 1 | 2 | $videoExtensions = '264', '265', 'asf', 'avc', 'avi', 'divx', 'flv', 'h264', 'h265', 'hevc', 'm2ts', 'm2v', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'mts', 'rar', 'ts', 'vob', 'webm', 'wmv' 3 | $audioExtensions = 'aac', 'ac3', 'dts', 'dtshd', 'dtshr', 'dtsma', 'eac3', 'flac', 'm4a', 'mka', 'mp2', 'mp3', 'mpa', 'ogg', 'opus', 'thd', 'w64', 'wav' 4 | $cacheVersion = 45 5 | $culture = [Globalization.CultureInfo]::InvariantCulture 6 | 7 | function ConvertStringToInt($value) 8 | { 9 | try { 10 | [int]::Parse($value, $culture) 11 | } catch { 12 | 0 13 | } 14 | } 15 | 16 | function ConvertStringToDouble($value) 17 | { 18 | try { 19 | [double]::Parse($value, $culture) 20 | } catch { 21 | 0.0 22 | } 23 | } 24 | 25 | function ConvertStringToLong($value) 26 | { 27 | try { 28 | [long]::Parse($value, $culture) 29 | } catch { 30 | [long]0 31 | } 32 | } 33 | 34 | function Get-MediaInfo 35 | { 36 | [CmdletBinding()] 37 | [Alias('gmi')] 38 | Param( 39 | [parameter(ValueFromPipelineByPropertyName)] 40 | [Alias('FullName')] 41 | [string[]] $Path, 42 | 43 | [Switch]$Video, 44 | [Switch]$Audio 45 | ) 46 | 47 | begin 48 | { 49 | Add-Type -Path ($PSScriptRoot + '\MediaInfoSharp.dll') 50 | } 51 | 52 | Process 53 | { 54 | foreach ($file in $Path) 55 | { 56 | $file = Convert-Path -LiteralPath $file 57 | 58 | if (-not (Test-Path -LiteralPath $file -PathType Leaf)) 59 | { 60 | continue 61 | } 62 | 63 | $extension = [IO.Path]::GetExtension($file).TrimStart([char]'.') 64 | $chacheFileBase = $file + '-' + (Get-Item -LiteralPath $file).Length + '-' + $cacheVersion 65 | 66 | foreach ($char in [IO.Path]::GetInvalidFileNameChars()) 67 | { 68 | if ($chacheFileBase.Contains($char)) 69 | { 70 | $chacheFileBase = $chacheFileBase.Replace($char.ToString(), '-' + [int]$char + '-') 71 | } 72 | } 73 | 74 | $cacheFile = Join-Path ([IO.Path]::GetTempPath()) ($chacheFileBase + '.json') 75 | 76 | if (-not $Video -and -not $Audio) 77 | { 78 | if ($videoExtensions -contains $extension) 79 | { 80 | $Video = $true 81 | } 82 | elseif ($audioExtensions -contains $extension) 83 | { 84 | $Audio = $true 85 | } 86 | } 87 | 88 | if ($Video -and $videoExtensions -contains $extension) 89 | { 90 | if (Test-Path -LiteralPath $cacheFile) 91 | { 92 | Get-Content -LiteralPath $cacheFile -Raw | ConvertFrom-Json 93 | } 94 | else 95 | { 96 | $mi = New-Object MediaInfoSharp -ArgumentList $file 97 | 98 | $format = $mi.GetInfo('Video', 0, 'Format') 99 | 100 | if ($format -eq 'MPEG Video') 101 | { 102 | $format = 'MPEG' 103 | } 104 | 105 | $obj = [PSCustomObject]@{ 106 | FileName = [IO.Path]::GetFileName($file) 107 | Ext = $extension 108 | Format = $format 109 | DAR = ConvertStringToDouble $mi.GetInfo('Video', 0, 'DisplayAspectRatio') 110 | Width = ConvertStringToInt $mi.GetInfo('Video', 0, 'Width') 111 | Height = ConvertStringToInt $mi.GetInfo('Video', 0, 'Height') 112 | BitRate = (ConvertStringToInt $mi.GetInfo('Video', 0, 'BitRate')) / 1000 113 | Duration = (ConvertStringToDouble $mi.GetInfo('General', 0, 'Duration')) / 60000 114 | FileSize = (ConvertStringToLong $mi.GetInfo('General', 0, 'FileSize')) / 1024 / 1024 115 | FrameRate = ConvertStringToDouble $mi.GetInfo('Video', 0, 'FrameRate') 116 | AudioCodec = $mi.GetInfo('General', 0, 'Audio_Codec_List') 117 | TextFormat = $mi.GetInfo('General', 0, 'Text_Format_List') 118 | ScanType = $mi.GetInfo('Video', 0, 'ScanType') 119 | Range = $mi.GetInfo('Video', 0, 'colour_range') 120 | Primaries = $mi.GetInfo('Video', 0, 'colour_primaries') 121 | Transfer = $mi.GetInfo('Video', 0, 'transfer_characteristics') 122 | Matrix = $mi.GetInfo('Video', 0, 'matrix_coefficients') 123 | FormatProfile = $mi.GetInfo('Video', 0, 'Format_Profile') 124 | Directory = [IO.Path]::GetDirectoryName($file) 125 | } 126 | 127 | $mi.Dispose() 128 | $obj | ConvertTo-Json | Out-File -LiteralPath $cacheFile -Encoding UTF8 129 | $obj 130 | } 131 | } 132 | elseif ($Audio -and $audioExtensions -contains $extension) 133 | { 134 | if (Test-Path -LiteralPath $cacheFile) 135 | { 136 | Get-Content -LiteralPath $cacheFile -Raw | ConvertFrom-Json 137 | } 138 | else 139 | { 140 | $mi = New-Object MediaInfoSharp -ArgumentList $file 141 | 142 | $obj = [PSCustomObject]@{ 143 | FileName = [IO.Path]::GetFileName($file) 144 | Ext = $extension 145 | Format = $mi.GetInfo('Audio', 0, 'Format') 146 | Performer = $mi.GetInfo('General', 0, 'Performer') 147 | Track = $mi.GetInfo('General', 0, 'Track') 148 | Album = $mi.GetInfo('General', 0, 'Album') 149 | Year = $mi.GetInfo('General', 0, 'Recorded_Date') 150 | Genre = $mi.GetInfo('General', 0, 'Genre') 151 | Duration = (ConvertStringToDouble $mi.GetInfo('General', 0, 'Duration')) / 60000 152 | BitRate = (ConvertStringToInt $mi.GetInfo('Audio', 0, 'BitRate')) / 1000 153 | FileSize = (ConvertStringToLong $mi.GetInfo('General', 0, 'FileSize')) / 1024 / 1024 154 | Directory = [IO.Path]::GetDirectoryName($file) 155 | } 156 | 157 | $mi.Dispose() 158 | $obj | ConvertTo-Json | Out-File -LiteralPath $cacheFile -Encoding UTF8 159 | $obj 160 | } 161 | } 162 | } 163 | } 164 | } 165 | 166 | function Get-MediaInfoValue 167 | { 168 | [CmdletBinding()] 169 | [Alias('gmiv')] 170 | Param( 171 | [Parameter( 172 | Mandatory=$true, 173 | ValueFromPipeline=$true)] 174 | [string] $Path, 175 | 176 | [Parameter(Mandatory=$true)] 177 | [ValidateSet('General', 'Video', 'Audio', 'Text', 'Image', 'Menu')] 178 | [String] $Kind, 179 | 180 | [int] $Index, 181 | 182 | [Parameter(Mandatory=$true)] 183 | [string] $Parameter 184 | ) 185 | 186 | begin 187 | { 188 | Add-Type -Path ($PSScriptRoot + '\MediaInfoSharp.dll') 189 | } 190 | 191 | Process 192 | { 193 | $mi = New-Object MediaInfoSharp -ArgumentList (Convert-Path -LiteralPath $Path) 194 | $value = $mi.GetInfo($Kind, $Index, $Parameter) 195 | $mi.Dispose() 196 | return $value 197 | } 198 | } 199 | 200 | function Get-MediaInfoSummary 201 | { 202 | [CmdletBinding()] 203 | [Alias('gmis')] 204 | Param( 205 | [Parameter( 206 | Mandatory = $true, 207 | ValueFromPipeline = $true)] 208 | [string] $Path, 209 | 210 | [Parameter(Mandatory = $false)] 211 | [Switch] 212 | $Full, 213 | 214 | [Parameter(Mandatory = $false)] 215 | [Switch] 216 | $Raw 217 | ) 218 | 219 | begin 220 | { 221 | Add-Type -Path ($PSScriptRoot + '\MediaInfoSharp.dll') 222 | } 223 | 224 | Process 225 | { 226 | $mi = New-Object MediaInfoSharp -ArgumentList (Convert-Path -LiteralPath $Path) 227 | $value = $mi.GetSummary($Full, $Raw) 228 | $mi.Dispose() 229 | ("`r`n" + $value) -split "`r`n" 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /GridView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stax76/Get-MediaInfo/57e1e57d6d8f9048200b718dc2f36c1fa25d8e6e/GridView.png -------------------------------------------------------------------------------- /MediaInfoSharp/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MediaInfoSharp")] 9 | [assembly: AssemblyDescription(".NET wrapper for the native MediaInfo library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Frank Skare (stax76)")] 12 | [assembly: AssemblyProduct("MediaInfoSharp")] 13 | [assembly: AssemblyCopyright("Copyright (C) 2019-2020 Frank Skare (stax76)")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("224c544e-159e-4271-ae8e-96536c166c63")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.0.0")] 36 | [assembly: AssemblyFileVersion("3.3.0.0")] 37 | -------------------------------------------------------------------------------- /MediaInfoSharp/MediaInfoSharp.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.ComponentModel; 4 | using System.IO; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | 8 | public class MediaInfoSharp : IDisposable 9 | { 10 | IntPtr Handle; 11 | static bool Loaded; 12 | 13 | public MediaInfoSharp(string path) 14 | { 15 | if (!Loaded) 16 | { 17 | string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 18 | string dllPath = Path.Combine(assemblyDir, "MediaInfo.dll"); 19 | 20 | if (File.Exists(dllPath) && LoadLibrary(dllPath) == IntPtr.Zero) 21 | throw new Win32Exception(Marshal.GetLastWin32Error()); 22 | 23 | Loaded = true; 24 | } 25 | 26 | if ((Handle = MediaInfo_New()) == IntPtr.Zero) 27 | throw new Exception("Error MediaInfo_New"); 28 | 29 | if (MediaInfo_Open(Handle, path) == 0) 30 | throw new Exception("Error MediaInfo_Open"); 31 | } 32 | 33 | public int GetCount(MediaInfoStreamKind streamKind) => MediaInfo_Count_Get(Handle, streamKind, -1); 34 | 35 | public string GetInfo(MediaInfoStreamKind streamKind, int stream, string parameter) 36 | { 37 | return Marshal.PtrToStringUni(MediaInfo_Get(Handle, streamKind, stream, 38 | parameter, MediaInfoKind.Text, MediaInfoKind.Name)); 39 | } 40 | 41 | public string GetSummary(bool complete, bool rawView) 42 | { 43 | MediaInfo_Option(Handle, "Language", rawView ? "raw" : ""); 44 | MediaInfo_Option(Handle, "Complete", complete ? "1" : "0"); 45 | return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, 0)) ?? ""; 46 | } 47 | 48 | bool Disposed; 49 | 50 | public void Dispose() 51 | { 52 | if (!Disposed) 53 | { 54 | if (Handle != IntPtr.Zero) 55 | { 56 | MediaInfo_Close(Handle); 57 | MediaInfo_Delete(Handle); 58 | } 59 | 60 | Disposed = true; 61 | } 62 | } 63 | 64 | ~MediaInfoSharp() 65 | { 66 | Dispose(); 67 | } 68 | 69 | [DllImport("kernel32.dll")] 70 | public static extern IntPtr LoadLibrary(string path); 71 | 72 | [DllImport("MediaInfo.dll")] 73 | public static extern IntPtr MediaInfo_New(); 74 | 75 | [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] 76 | public static extern int MediaInfo_Open(IntPtr handle, string path); 77 | 78 | [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] 79 | public static extern IntPtr MediaInfo_Option(IntPtr handle, string option, string value); 80 | 81 | [DllImport("MediaInfo.dll")] 82 | public static extern IntPtr MediaInfo_Inform(IntPtr handle, int reserved); 83 | 84 | [DllImport("MediaInfo.dll")] 85 | public static extern int MediaInfo_Close(IntPtr handle); 86 | 87 | [DllImport("MediaInfo.dll")] 88 | public static extern void MediaInfo_Delete(IntPtr handle); 89 | 90 | [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] 91 | public static extern IntPtr MediaInfo_Get(IntPtr handle, MediaInfoStreamKind streamKind, 92 | int stream, string parameter, MediaInfoKind infoKind, MediaInfoKind searchKind); 93 | 94 | [DllImport("MediaInfo.dll", CharSet = CharSet.Unicode)] 95 | public static extern int MediaInfo_Count_Get(IntPtr handle, MediaInfoStreamKind streamKind, int stream); 96 | } 97 | 98 | public enum MediaInfoStreamKind 99 | { 100 | General, 101 | Video, 102 | Audio, 103 | Text, 104 | Other, 105 | Image, 106 | Menu, 107 | Max, 108 | } 109 | 110 | public enum MediaInfoKind 111 | { 112 | Name, 113 | Text, 114 | Measure, 115 | Options, 116 | NameText, 117 | MeasureText, 118 | Info, 119 | HowTo 120 | } 121 | -------------------------------------------------------------------------------- /MediaInfoSharp/MediaInfoSharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {224C544E-159E-4271-AE8E-96536C166C63} 8 | Library 9 | Properties 10 | MediaInfoSharp 11 | MediaInfoSharp 12 | v4.8 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MediaInfoSharp/MediaInfoSharp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaInfoSharp", "MediaInfoSharp.csproj", "{224C544E-159E-4271-AE8E-96536C166C63}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {224C544E-159E-4271-AE8E-96536C166C63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {224C544E-159E-4271-AE8E-96536C166C63}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {224C544E-159E-4271-AE8E-96536C166C63}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {224C544E-159E-4271-AE8E-96536C166C63}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B7E9654E-82CD-4C0D-B4E8-E26FE95338C3} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Get-MediaInfo 3 | ============= 4 | 5 | Get-MediaInfo is a PowerShell MediaInfo solution. 6 | 7 | It consists of three functions: 8 | 9 | - [Get-MediaInfo](#get-mediainfo) 10 | - [Get-MediaInfoValue](#get-mediainfovalue) 11 | - [Get-MediaInfoSummary](#get-mediainfosummary) 12 | 13 | ![-](Summary.jpg) 14 | 15 | ![-](GridView.png) 16 | 17 | 18 | Installation 19 | ------------ 20 | 21 | Installation or download via PowerShellGet: 22 | 23 | https://www.powershellgallery.com/packages/Get-MediaInfo 24 | 25 | 26 | Get-MediaInfo 27 | ------------- 28 | 29 | Converts media file objects into MediaInfo objects. 30 | 31 | ``` 32 | NAME 33 | Get-MediaInfo 34 | 35 | SYNTAX 36 | Get-MediaInfo [[-Path] ] [-Video] [-Audio] [] 37 | 38 | ALIASES 39 | gmi 40 | ``` 41 | 42 | 43 | Description 44 | ----------- 45 | 46 | Converts media file objects into MediaInfo objects. 47 | 48 | 49 | Examples 50 | -------- 51 | 52 | Displays media files of the defined folder using a grid view. 53 | 54 | ```PowerShell 55 | Get-ChildItem 'D:\Samples' | Get-MediaInfo | Out-GridView 56 | ``` 57 | 58 | 59 | Same as above but using the current folder and aliases. 60 | 61 | ```PowerShell 62 | gci | gmi | ogv 63 | ``` 64 | 65 | 66 | Find duplicates by comparing the duration. 67 | 68 | ```PowerShell 69 | gci | gmi | select filename, duration, filesize | group duration | where { $_.count -gt 1 } | select -expand group | format-list 70 | ``` 71 | 72 | 73 | Parameters 74 | ---------- 75 | 76 | **-Path** 77 | 78 | String array with audio or video files or FileInfo objects via pipeline. 79 | 80 | 81 | **-Video** 82 | 83 | Only video files will be processed. 84 | 85 | 86 | **-Audio** 87 | 88 | Only audio files will be processed. 89 | 90 | 91 | Input 92 | ----- 93 | 94 | String array with audio or video files as Path parameter or FileInfo objects via pipeline. 95 | 96 | 97 | Output 98 | ------ 99 | 100 | MediaInfo objects. 101 | 102 | 103 | Get-MediaInfoValue 104 | ================== 105 | 106 | Returns specific properties from media files. 107 | 108 | ``` 109 | NAME 110 | Get-MediaInfoValue 111 | 112 | SYNTAX 113 | Get-MediaInfoValue 114 | [-Path] 115 | [-Kind] {General | Video | Audio | Text | Image | Menu} 116 | [[-Index] ] 117 | [-Parameter] 118 | [] 119 | 120 | ALIASES 121 | gmiv 122 | ``` 123 | 124 | Description 125 | ----------- 126 | 127 | Returns specific properties from media files. 128 | 129 | 130 | Examples 131 | -------- 132 | 133 | Get the artist from a MP3 file. 134 | 135 | ```PowerShell 136 | Get-MediaInfoValue '.\Meg Myers - Desire (Hucci Remix).mp3' -Kind General -Parameter Performer 137 | 138 | Meg Myers 139 | ``` 140 | 141 | 142 | Get the channel count in a MP3 file. Return types are always strings and if necessary must be cast to integer. 143 | 144 | ```PowerShell 145 | '.\Meg Myers - Desire (Hucci Remix).mp3' | Get-MediaInfoValue -Kind Audio -Parameter 'Channel(s)' 146 | 147 | 2 148 | ``` 149 | 150 | 151 | Get the language of the second audio stream in a movie. 152 | 153 | The Index parameter is zero based. 154 | 155 | ```PowerShell 156 | Get-MediaInfoValue '.\The Warriors.mkv' -Kind Audio -Index 1 -Parameter 'Language/String' 157 | 158 | English 159 | ``` 160 | 161 | 162 | Get the count of subtitle streams in a movie. 163 | 164 | ```PowerShell 165 | Get-MediaInfoValue '.\The Warriors.mkv' -Kind General -Parameter 'TextCount' 166 | 167 | 2 168 | ``` 169 | 170 | 171 | Parameters 172 | ---------- 173 | 174 | **-Path** 175 | 176 | Path to a media file. 177 | 178 | 179 | **-Kind** General | Video | Audio | Text | Image | Menu 180 | 181 | A MediaInfo kind. 182 | 183 | Kinds and their properties can be seen with [MediaInfo.NET](https://github.com/stax76/MediaInfo.NET). 184 | 185 | 186 | **-Index** 187 | 188 | Zero based stream number. 189 | 190 | 191 | **-Parameter** 192 | 193 | Name of the property to get. 194 | 195 | The property names can be seen with [MediaInfo.NET](https://github.com/stax76/MediaInfo.NET) with following setting enabled: 196 | 197 | Show parameter names as they are used in the MediaInfo API 198 | 199 | They can also be seen with Get-MediaInfoSummary with the -Raw flag enabled. 200 | 201 | 202 | Input 203 | ----- 204 | 205 | Input can be defined with the Path parameter, pipe input supports a path as string or a FileInfo object. 206 | 207 | 208 | Output 209 | ------ 210 | 211 | Output will always be of type string and must be cast to other types like integer if necessary. 212 | 213 | 214 | Using the .NET class directly for highest performance 215 | ----------------------------------------------------- 216 | 217 | To retrieve specific properties with highest possible performance the .NET class must be used directly: 218 | 219 | ``` 220 | $mi = New-Object MediaInfo -ArgumentList $Path 221 | $value1 = $mi.GetInfo($Kind, $Index, $Parameter) 222 | $value2 = $mi.GetInfo($Kind, $Index, $Parameter) 223 | $mi.Dispose() 224 | ``` 225 | 226 | Get-MediaInfoSummary 227 | -------------------- 228 | 229 | Shows a summary in text format for a media file. 230 | 231 | ``` 232 | NAME 233 | Get-MediaInfoSummary 234 | 235 | SYNTAX 236 | Get-MediaInfoSummary [-Path] [-Full] [-Raw] [] 237 | 238 | ALIASES 239 | gmis 240 | ``` 241 | 242 | Description 243 | ----------- 244 | 245 | Shows a summary in text format for a media file. 246 | 247 | Examples 248 | -------- 249 | 250 | ```PowerShell 251 | Get-MediaInfoSummary 'D:\Samples\Downton Abbey.mkv' 252 | ``` 253 | 254 | Parameters 255 | ---------- 256 | 257 | **-Path** 258 | 259 | Path to a media file. Can also be passed via pipeline. 260 | 261 | 262 | **-Full** 263 | 264 | Show a extended summary. 265 | 266 | 267 | **-Raw** 268 | 269 | Show not the friendly parameter names but rather the names as they are used in the MediaInfo API. 270 | 271 | Parameter names passed to Get-MediaInfoValue -Parameter must use the raw parameter name. 272 | 273 | 274 | Input 275 | ----- 276 | 277 | Path as string to a media file. Can also be passed via pipeline. 278 | 279 | 280 | Output 281 | ------ 282 | 283 | A summary line by line as string array. 284 | 285 | 286 | Related apps 287 | ------------ 288 | 289 | Find a list of related apps: 290 | 291 | https://stax76.github.io/frankskare 292 | -------------------------------------------------------------------------------- /Release.ps1: -------------------------------------------------------------------------------- 1 | 2 | $targetDir = 'D:\Work\Get-MediaInfo' 3 | New-Item -Path $targetDir -ItemType Directory | Out-Null 4 | Copy-Item .\MediaInfo.dll "$targetDir\MediaInfo.dll" 5 | Copy-Item .\MediaInfoSharp.dll "$targetDir\MediaInfoSharp.dll" 6 | Copy-Item .\MediaInfoSharp.pdb "$targetDir\MediaInfoSharp.pdb" 7 | Copy-Item .\Get-MediaInfo.psd1 "$targetDir\Get-MediaInfo.psd1" 8 | Copy-Item .\Get-MediaInfo.psm1 "$targetDir\Get-MediaInfo.psm1" 9 | 10 | $key = Read-Host 'Enter Api Key' 11 | 12 | Publish-Module -Path $targetDir -NuGetApiKey $key 13 | -------------------------------------------------------------------------------- /Summary.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stax76/Get-MediaInfo/57e1e57d6d8f9048200b718dc2f36c1fa25d8e6e/Summary.jpg --------------------------------------------------------------------------------