Last active
January 21, 2016 21:29
-
-
Save alea12/cec6a92fa4163ed8bf39 to your computer and use it in GitHub Desktop.
HandbrakeQSVBatch.ps1
This file contains 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
while (1) { | |
net use "\\192.168.xxx.xxx\share" | |
$filelist = Get-ChildItem \\192.168.xxx.xxx\share\video\ -filter *.m2ts | |
$num = $filelist | measure | |
$filecount = $num.count | |
$i = 0; | |
ForEach ($file in $filelist) | |
{ | |
$i++; | |
$oldfile = $file.DirectoryName + "\" + $file.BaseName + $file.Extension; | |
$newfile = "C:\tmp\" + $file.BaseName + ".qsv.mp4"; | |
$progress = ($i / $filecount) * 100 | |
$progress = [Math]::Round($progress,2) | |
Clear-Host | |
Write-Host -------------------------------------------------------- | |
Write-Host Handbrake Batch Encoding | |
Write-Host "Processing - $oldfile" | |
Write-Host "File $i of $filecount - $progress%" | |
Write-Host -------------------------------------------------------- | |
Start-Process "C:\Program Files\HandBrake\HandBrakeCLI.exe" -ArgumentList "-i `"$oldfile`" -t 1 -o `"$newfile`" -f mp4 --decomb=fast -w 720 --crop 0:0:0:0 -e qsv_h264 -q 20 --cfr -a 1 -E av_aac -6 dpl2 -R Auto -B 160 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=quality --encoder-level=4.1 --encoder-profile=high --verbose=1" -Wait -NoNewWindow | |
Move-Item $newfile $file.DirectoryName | |
Remove-Item $oldfile | |
} | |
$now = Get-Date -format "yyyy/MM/dd HH:mm" | |
Write-Host ("[" + $now + "] No file found. Waiting...") | |
Start-Sleep -s 60 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment