if (!(Test-Path -Path "c" -PathType Container)) { mkdir "c" } $files = Get-ChildItem ("*.mp4", "*.mov") $index = 0 $total = $files.Length foreach ($file in $files) { $index++ Write-Host "***** ($index/$total) $($file.Name)" -ForegroundColor Magenta ffmpeg -hide_banner -i $file -map_metadata 0 -movflags use_metadata_tags -c:v libx265 -preset slow -crf 26 -c:a aac -b:a 64k $("c\" + $file.BaseName + ".mp4") }