Skip to content

Instantly share code, notes, and snippets.

@tillig
Created April 13, 2017 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tillig/ff14af21c865be0c717c33799ca97b3b to your computer and use it in GitHub Desktop.
Save tillig/ff14af21c865be0c717c33799ca97b3b to your computer and use it in GitHub Desktop.
Find SD movies in a file location
$fileLocation = "\\diskstation\video\Movies\"
# This is the CLI version of MediaInfo
# https://mediaarea.net/en/MediaInfo
$mediaInfoLocation = "C:\util\MediaInfo.exe"
Get-ChildItem $fileLocation -Filter *.m4v -Recurse | %{
$path = $_.FullName
[xml]$info = & $mediaInfoLocation --Output=XML "$path"
$video = $info.Mediainfo.File.track | Where-Object { $_.type -eq "Video" }
$width = [int]$video.Width.Replace(" pixels", "").Replace(" ", "")
$height = [int]$video.Height.Replace(" pixels", "").Replace(" ", "")
# HD is 1900 x 1080
# SD is 720 x 480
# Assume anything less than about 1100 is
# SD, depending on how it's been ripped/shot
if($width -lt 1100)
{
Write-Output "$path ($width x $height)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment