Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- $Files = Get-ChildItem -Path "D:\Media\Movies" -Exclude "*.ps1","*.srt" -Recurse
- $CSVFile = "C:\Temp\MediaInfo.csv" #Use $null if you don't want to export to CSV
- $objTemplate = New-Object psobject
- $objTemplate | Add-Member -MemberType NoteProperty -Name FileName -Value $null
- $objTemplate | Add-Member -MemberType NoteProperty -Name FullPath -Value $null
- $objTemplate | Add-Member -MemberType NoteProperty -Name Width -Value $null
- $objTemplate | Add-Member -MemberType NoteProperty -Name Height -Value $null
- $objTemplate | Add-Member -MemberType NoteProperty -Name BitRate_kbps -Value $null
- $objResult = @()
- $i = 1
- foreach($File in $Files) {
- $PercComplete = ($i / $Files.Count) * 100
- Write-Progress -Activity "Getting info.." -Status "Getting information for $($File.Name) ($i/$($Files.Count))" -PercentComplete $PercComplete
- #Update the location of the MediaInfo.exe
- $Info = C:\Users\Shayne\Desktop\MediaInfo_CLI\MediaInfo.exe "--Inform=Video;%Width%,%Height%,%BitRate%" $File.FullName
- $objTemp = $objTemplate | Select-Object *
- $objTemp.FileName = $File.Name
- $objTemp.FullPath = $File.FullName
- $objTemp.Width = $Info.Split(",")[0]
- $objTemp.Height = $Info.Split(",")[1]
- $objTemp.BitRate_kbps = [int](($Info.Split(",")[2]) / 1024)
- $objResult += $objTemp
- $i++
- }
- $objResult | Format-Table -AutoSize
- if ($CSVFile) {
- $objResult | Export-Csv -Path $CSVFile -NoTypeInformation -Force
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement