-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHandBrakeConverter.ps1
37 lines (29 loc) · 1.55 KB
/
HandBrakeConverter.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Write-Log {
Param(
$Message,
$Path = "$env:LOGS_DIR\HandBrakeCLI.txt"
)
function TS {Get-Date -Format 'hh:mm:ss'}
"[$(TS)]$Message" | Tee-Object -FilePath $Path -Append | Write-Verbose
}
$filelist = Get-ChildItem "C:\Users\alexa\Downloads\ReadingRainbow"
$num = $filelist | Measure-Object
$filecount = $num.count
$i = 0;
ForEach ($file in $filelist)
{
$i++;
$oldfile = $file.DirectoryName + "\" + $file.BaseName + $file.Extension;
$newfile = "P:\tv.kids\Reading.Rainbow" + "\" + $file.BaseName + ".mkv";
$progress = ($i / $filecount) * 100
$progress = [Math]::Round($progress,2)
Clear-Host
Write-Host "`n`n"
Write-Host -BackgroundColor White -ForegroundColor DarkGray "-------------------------------------------------------------------------------"
Write-Host -BackgroundColor White -ForegroundColor DarkGray " Handbrake Batch Encoding "
Write-Host -BackgroundColor White -ForegroundColor DarkGray " Processing: `"$oldfile`" "
Write-Host -BackgroundColor White -ForegroundColor DarkGray "-------------------------------------------------------------------------------"
Write-Host "`n`n"
Start-Process "D:\Applications\HandBrake\HandBrakeCLI.exe" -ArgumentList "-Z `"H.264 MKV 1080p30`" -i `"$oldfile`" -o `"$newfile`" --verbose=0" -Wait -NoNewWindow | Write-Log
}
Write-Progress -Activity "Encoding in progress ... " -Status "$progress% Complete" -PercentComplete $progress