35 lines
1.0 KiB
PowerShell
35 lines
1.0 KiB
PowerShell
$ffprobe = 'D:\yt-dlp\ffprobe.exe'
|
|
$FolderToReview = 'Q:\Web-RegulationPodcast\Unsorted'
|
|
|
|
if (-not (Test-Path $ffprobe)) {
|
|
Write-Error "ffprobe.exe not found at '$ffprobe'. Please verify the path."
|
|
exit 1
|
|
}
|
|
|
|
$results = Get-ChildItem -Path $FolderToReview -Recurse -Filter *.mp4 | ForEach-Object {
|
|
$file = $_.FullName
|
|
Write-Verbose "Processing: $file" -Verbose
|
|
|
|
# Run ffprobe, suppress stderr, capture stdout
|
|
$rawOutput = & $ffprobe -v error `
|
|
-select_streams v:0 `
|
|
-show_entries stream=width,height `
|
|
-of csv=p=0:s=x `
|
|
$file 2>$null
|
|
|
|
# Clean up output and handle missing/invalid streams
|
|
$resolution = $rawOutput.Trim()
|
|
if ([string]::IsNullOrWhiteSpace($resolution)) {
|
|
$resolution = 'No video stream or unreadable'
|
|
}
|
|
|
|
[PSCustomObject]@{
|
|
File = $file
|
|
Resolution = $resolution
|
|
}
|
|
}
|
|
|
|
$results | Format-Table -AutoSize
|
|
|
|
# Optional: Export to CSV
|
|
# $results | Export-Csv -Path 'Q:\Web-RegulationPodcast\video_resolutions.csv' -NoTypeInformation |