Skip to content

Instantly share code, notes, and snippets.

@prodehghan
Last active August 10, 2020 14:27
Show Gist options
  • Save prodehghan/131229403b729eacdef3259e64d98f63 to your computer and use it in GitHub Desktop.
Save prodehghan/131229403b729eacdef3259e64d98f63 to your computer and use it in GitHub Desktop.
Converts/compresses all video (.mp4 and .mov) files in current directory to x265
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")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment