Poniższy skrypt PowerShell umożliwia automatyczną kompresję materiałów video w folderze i podfolderach.
gci . *.mp4 -R |
foreach-object {
$saveBase = "v:\handbrake"
$curDir = (Get-Item -Path ".\" -Verbose).FullName
$inName = $_.BaseName + $_.Extension
$inFile = $_.DirectoryName + "\" + $inName
$outFile = $saveBase + $inFile.replace($curDir, "")
$outDir = $outFile.replace($inName, "")
New-Item -path "$outDir" -type directory -force
echo "Working on $inFile"
echo "Saving to $outFile"
&"C:\Program Files\HandBrake\HandBrakeCLI.exe" -i "$inFile" -o "$outFile" --preset "Very Fast 1080p30"
}
Źródła i inne tematycznie związane artykuły:
http://www.codegist.net/search/handbrake%20recursive%20encode/1
https://dzone.com/articles/poor-mans-batch-encoding-with-handbrake
https://www.hanselman.com/blog/BatchConvertingADirectoryTreeOfVideosRecursivelyWithHandbrakeForStreamingToAnXbox360.aspx
https://jorge.fbarr.net/2012/05/19/batch-convert-videos-using-handbrake-and-a-script/