Created
April 21, 2015 21:02
-
-
Save mullnerz/7b0123dd0e6a3cee8e2f to your computer and use it in GitHub Desktop.
mass converting video files using powershell and handbrake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# originated from: | |
# https://perfp.wordpress.com/2010/08/25/mass-converting-video-files-using-powershell-and-handbrake/ | |
$outdir = "C:\Temp\convert-avi" | |
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath | |
$files = Get-Childitem -Recurse -Include "*.avi" | |
foreach ($file in $files) { | |
$subpath = $file.DirectoryName.Replace((Get-Location -PSProvider FileSystem).ProviderPath , "") | |
$destdir = $outdir + $subpath | |
$destname = $destdir + "\" + $file.BaseName + ".mp4" | |
if (!(Test-Path $destdir)) { | |
New-Item $destdir -type directory | |
} | |
if (!(Test-Path $destname)) { | |
& "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i $file -t 1 -c 1 -o $destname --preset "Normal" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment