$loc = $args[0] If ($args.length -eq 0) { "Defaulting to current directory of `"$(Get-Location)`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" } ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) { "Path `"$loc`" was found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" } Else { "Path `"$loc`" was not found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" exit } @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({ "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" $pat = Split-Path ($_).FullName $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" $new = "$pat\$(($_).BaseName)_PRORES.mov" If ($codec -eq "vp8") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } ElseIF ($codec -eq "vp9") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } Else { ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" }) @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({ If ($_ -notmatch "_PRORES.mov") { $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" If ($codec -eq "rawvideo") { "File `"$_`" is already in prores MOV format - skipping..." | Out-File -append -noClobber -encoding UTF8 -filepath "$(Get-Location)\media_to_prores.log" } Else { "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_PRORES.mov" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" } } }) @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({ "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_PRORES.mov" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" }) @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({ "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" $pat = Split-Path ($_).FullName $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" $new = "$pat\$(($_).BaseName)_PRORES.mov" If ($codec -eq "vp8") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } ElseIF ($codec -eq "vp9") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } Else { ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" } "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" }) @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({ "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_PRORES.mov" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" })