-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStingerStacker.ps1
63 lines (52 loc) · 2.23 KB
/
StingerStacker.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#push script location
$scriptPath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptPath
Push-Location $dir
#loading functions
. .\helpers\commonFunctions.ps1
. .\helpers\Verifier.ps1
write-host "Variable Input Stinger Stacker" -ForegroundColor Magenta -BackgroundColor black
write-host "`r"
write-host "`r"
Write-Host "You will be prompted to select two files. First select the STINGER, and then pick the MATTE" -ForegroundColor Yellow
Pause
$inputStinger = Get-FileName
if ($inputStinger -eq "") {
Write-Host "you didn't select anything, exiting" -ForegroundColor Red
Pause
exit
}
$inputMatte = Get-FileName
if ($inputStinger -eq "") {
Write-Host "you didn't select anything, exiting" -ForegroundColor Red
Pause
exit
}
Push-Location -path $rootLocation #Don't edit edit this, edit the config.json or delete it
$Name = Get-ChildItem $inputStinger
$shortName = $Name.BaseName
$inputCodec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 $inputStinger
write-host "`r"
Write-Host "Working on it, promise, please be patient" -ForegroundColor Yellow
if ($inputCodec -eq "vp9") {
write-host "vp9, ensuring correct decoder" -ForegroundColor Yellow
ffmpeg -loglevel 25 -c:v libvpx-vp9 -i "$inputStinger" -i "$inputMatte" `
-filter_complex "hstack,format=yuva420p" -c:v libvpx-vp9 -crf 31 -b:v 0 -cpu-used 5 `
-pix_fmt yuva420p $outputVids\$shortName-stacked.webm
} elseif ($inputCodec -eq "vp8") {
write-host "vp8, ensuring correct decoder" -ForegroundColor Yellow
ffmpeg -loglevel 25 -c:v libvpx -i "$inputStinger" -i "$inputMatte" `
-filter_complex "hstack,format=yuva420p" -c:v libvpx-vp9 -crf 31 -b:v 0 -cpu-used 5 `
-pix_fmt yuva420p $outputVids\$shortName-stacked.webm
} else {
Write-Host "not a webm, trying auto" -ForegroundColor Yellow
ffmpeg -loglevel 25 -i "$inputStinger" -i "$inputMatte" `
-filter_complex "hstack" -c:v libvpx-vp9 -crf 31 -b:v 0 -cpu-used 5 `
-pix_fmt yuva420p $outputVids\$shortName-stacked.webm
}
write-host "`r"
Write-Host "done! Please test $outputVids\$shortName-stacked.webm" -ForegroundColor Green
Pop-Location #pop location twice to return you to
Pop-Location #the working dir it was ran from
pause
exit 0