Get-MediaInfo is a PowerShell MediaInfo solution.
It consists of four functions:
- Simply clone this repository or download the source archive file of this repository
- Place the files into one of PowerShell's automatic module paths (or import it manually, or via your
$PROFILE
file)- Example:
~\Documents\PowerShell\Modules\Get-MediaInfo\3.8.0
- Example:
The documentation beyond this point still reflects the state of the original project and has not been completely updated yet.
Usage should be pretty self-explanatory anyway.
Converts media file objects into MediaInfo objects.
NAME
Get-MediaInfo
SYNTAX
Get-MediaInfo [[-Path] <string[]>] [-Video] [-Audio] [<CommonParameters>]
ALIASES
gmi
Converts media file objects into MediaInfo objects.
Displays media files of the defined folder using a grid view.
Get-ChildItem 'D:\Samples' | Get-MediaInfo | Out-GridView
Same as above but using the current folder and aliases.
gci | gmi | ogv
Find duplicates by comparing the duration.
gci | gmi | select filename, duration, filesize | group duration | where { $_.count -gt 1 } | select -expand group | format-list
-Path
String array with audio or video files or FileInfo objects via pipeline.
-Video
Only video files will be processed.
-Audio
Only audio files will be processed.
String array with audio or video files as Path parameter or FileInfo objects via pipeline.
MediaInfo objects.
Returns specific properties from media files.
NAME
Get-MediaInfoValue
SYNTAX
Get-MediaInfoValue
[-Path] <string>
[-Kind] {General | Video | Audio | Text | Image | Menu}
[[-Index] <int>]
[-Parameter] <string>
[<CommonParameters>]
ALIASES
gmiv
Returns specific properties from media files.
Get the artist from a MP3 file.
Get-MediaInfoValue '.\Meg Myers - Desire (Hucci Remix).mp3' -Kind General -Parameter Performer
Meg Myers
Get the channel count in a MP3 file. Return types are always strings and if necessary must be cast to integer.
'.\Meg Myers - Desire (Hucci Remix).mp3' | Get-MediaInfoValue -Kind Audio -Parameter 'Channel(s)'
2
Get the language of the second audio stream in a movie.
The Index parameter is zero based.
Get-MediaInfoValue '.\The Warriors.mkv' -Kind Audio -Index 1 -Parameter 'Language/String'
English
Get the count of subtitle streams in a movie.
Get-MediaInfoValue '.\The Warriors.mkv' -Kind General -Parameter 'TextCount'
2
-Path
Path to a media file.
-Kind General | Video | Audio | Text | Image | Menu
A MediaInfo kind.
Kinds and their properties can be seen with MediaInfo.NET.
-Index
Zero based stream number.
-Parameter
Name of the property to get.
The property names can be seen with MediaInfo.NET with following setting enabled:
Show parameter names as they are used in the MediaInfo API
They can also be seen with Get-MediaInfoSummary with the -Raw flag enabled.
Input can be defined with the Path parameter, pipe input supports a path as string or a FileInfo object.
Output will always be of type string and must be cast to other types like integer if necessary.
To retrieve specific properties with highest possible performance the .NET class must be used directly:
$mi = New-Object MediaInfo -ArgumentList $Path
$value1 = $mi.GetInfo($Kind, $Index, $Parameter)
$value2 = $mi.GetInfo($Kind, $Index, $Parameter)
$mi.Dispose()
Shows a summary in text format for a media file.
NAME
Get-MediaInfoSummary
SYNTAX
Get-MediaInfoSummary [-Path] <string> [-Full] [-Raw] [<CommonParameters>]
ALIASES
gmis
Shows a summary in text format for a media file.
Get-MediaInfoSummary 'D:\Samples\Downton Abbey.mkv'
-Path
Path to a media file. Can also be passed via pipeline.
-Full
Show a extended summary.
-Raw
Show not the friendly parameter names but rather the names as they are used in the MediaInfo API.
Parameter names passed to Get-MediaInfoValue -Parameter must use the raw parameter name.
Path as string to a media file. Can also be passed via pipeline.
A summary line by line as string array.
Deletes the locally cached results created by Get-MediaInfo $MyInput -WriteCache
.
None.
None.