-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathencode.ps1
More file actions
28 lines (22 loc) · 808 Bytes
/
encode.ps1
File metadata and controls
28 lines (22 loc) · 808 Bytes
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
param (
[Parameter(Mandatory = $true)][string]$dest_dir,
[Parameter(Mandatory = $true)][string]$source_glob
)
$ErrorActionPreference = "Stop"
Write-Output "Started encode loop..."
while ($true) {
foreach ($source in Get-Item $source_glob | Sort-Object) {
$temp = Join-Path $dest_dir ($source.BaseName + "-x264.tmp")
$encoded = Join-Path $dest_dir ($source.BaseName + "-x264.mp4")
if (Test-Path -LiteralPath $encoded -PathType Leaf) {
continue
}
Write-Output "Encoding $source"
& .\runtime\HandBrakeCLI -i "$source" -o "$temp" --preset-import-file "x264.json" --preset "x264"
if (! $?) {
exit 1
}
Move-Item -LiteralPath "$temp" -Destination "$encoded"
}
Start-Sleep 60
}