Change NCNN_GPU_ID=-1 handling in Clone-Image.ps1 to omit upscayl-bin -g flag instead of passing -1 (which the tested build rejects), update documentation across Clone-Image.md, SKILL.md, README.md and index.md to clarify -1 means CPU for rife-ncnn-vulkan but default device for upscayl-bin, wrap Get-SrtContent calls in Create-FullSubtitle.ps1 with @() array operator to ensure Count property exists when parsing returns single entry, fix Get-FramesRange.ps1 output directory resolution to use Resolve-Path before
This commit is contained in:
1 parent
de238fb9c3
commit
fcc208e351
7 files changed
+13
-12
No files matched your search
+4
-3
@@ -33,7 +33,7 @@
|
|||||||
ffmpeg input, so any -Size / -LTX cover-scale-then-crop is applied to the upscaled image.
|
ffmpeg input, so any -Size / -LTX cover-scale-then-crop is applied to the upscaled image.
|
||||||
Requires upscayl-bin.exe in PATH, the UPSCAYL_HOME environment variable pointing to the
|
Requires upscayl-bin.exe in PATH, the UPSCAYL_HOME environment variable pointing to the
|
||||||
upscayl-bin install directory, and the NCNN_GPU_ID environment variable set to the desired
|
upscayl-bin install directory, and the NCNN_GPU_ID environment variable set to the desired
|
||||||
GPU device ID (-1 for CPU, 0/1/2/... for GPU).
|
GPU device ID (0/1/2/... for a GPU, or -1 to omit the -g flag so upscayl-bin uses its default device).
|
||||||
.PARAMETER Model
|
.PARAMETER Model
|
||||||
Upscayl model name (without extension) to use when -Upscale is specified. Defaults to
|
Upscayl model name (without extension) to use when -Upscale is specified. Defaults to
|
||||||
'4xNomos8kSC'. The model files (<Model>.bin and <Model>.param) must exist under
|
'4xNomos8kSC'. The model files (<Model>.bin and <Model>.param) must exist under
|
||||||
@@ -328,7 +328,7 @@ if ($Upscale -gt 0) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
if ($gpuId -notmatch '^-?\d+$') {
|
if ($gpuId -notmatch '^-?\d+$') {
|
||||||
Write-Error ('NCNN_GPU_ID must be an integer (-1 for CPU, 0+ for GPU). Current value: {0}' -f $gpuId)
|
Write-Error ('NCNN_GPU_ID must be an integer (-1 for the default device, 0+ for a GPU index). Current value: {0}' -f $gpuId)
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +337,8 @@ if ($Upscale -gt 0) {
|
|||||||
Write-Host ('Upscaling source with upscayl-bin (x{0}, model={1}, gpu={2})...' -f $Upscale, $Model, $gpuId)
|
Write-Host ('Upscaling source with upscayl-bin (x{0}, model={1}, gpu={2})...' -f $Upscale, $Model, $gpuId)
|
||||||
Write-Host (' Upscayl temp file: {0}' -f $upscaledTempPath)
|
Write-Host (' Upscayl temp file: {0}' -f $upscaledTempPath)
|
||||||
|
|
||||||
$upscaylArgs = @('-i', $SourcePath, '-o', $upscaledTempPath, '-s', $Upscale.ToString(), '-n', $Model, '-m', $modelsDir, '-g', $gpuId)
|
$upscaylArgs = @('-i', $SourcePath, '-o', $upscaledTempPath, '-s', $Upscale.ToString(), '-n', $Model, '-m', $modelsDir)
|
||||||
|
if ([int]$gpuId -ge 0) { $upscaylArgs += @('-g', $gpuId) }
|
||||||
$upscaylCmdLine = '"{0}" {1}' -f $upscaylExePath, (($upscaylArgs | ForEach-Object {
|
$upscaylCmdLine = '"{0}" {1}' -f $upscaylExePath, (($upscaylArgs | ForEach-Object {
|
||||||
if ($_ -match '\s') { '"{0}"' -f $_ } else { $_ }
|
if ($_ -match '\s') { '"{0}"' -f $_ } else { $_ }
|
||||||
}) -join ' ')
|
}) -join ' ')
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ function Export-SrtFile {
|
|||||||
#region Main Script
|
#region Main Script
|
||||||
|
|
||||||
Write-Host "Parsing first subtitle file: $Subtitle1"
|
Write-Host "Parsing first subtitle file: $Subtitle1"
|
||||||
$subtitle1Entries = Get-SrtContent -SrtPath $Subtitle1
|
$subtitle1Entries = @(Get-SrtContent -SrtPath $Subtitle1)
|
||||||
Write-Host " Found $($subtitle1Entries.Count) entries"
|
Write-Host " Found $($subtitle1Entries.Count) entries"
|
||||||
|
|
||||||
if ($subtitle1Entries.Count -eq 0) {
|
if ($subtitle1Entries.Count -eq 0) {
|
||||||
@@ -210,7 +210,7 @@ $videoDurationFormatted = ConvertFrom-TimeSpan -TimeSpan ([TimeSpan]::FromSecond
|
|||||||
Write-Host " Video duration: $videoDurationFormatted (${videoDuration}s)"
|
Write-Host " Video duration: $videoDurationFormatted (${videoDuration}s)"
|
||||||
|
|
||||||
Write-Host "Parsing second subtitle file: $Subtitle2"
|
Write-Host "Parsing second subtitle file: $Subtitle2"
|
||||||
$subtitle2Entries = Get-SrtContent -SrtPath $Subtitle2
|
$subtitle2Entries = @(Get-SrtContent -SrtPath $Subtitle2)
|
||||||
Write-Host " Found $($subtitle2Entries.Count) entries"
|
Write-Host " Found $($subtitle2Entries.Count) entries"
|
||||||
|
|
||||||
if ($subtitle2Entries.Count -eq 0) {
|
if ($subtitle2Entries.Count -eq 0) {
|
||||||
|
|||||||
+1
-1
@@ -112,7 +112,7 @@ $frameCount = $endFrame - $startFrame + 1
|
|||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($Images)) {
|
if ([string]::IsNullOrWhiteSpace($Images)) {
|
||||||
$videoBaseName = [System.IO.Path]::GetFileNameWithoutExtension($Video)
|
$videoBaseName = [System.IO.Path]::GetFileNameWithoutExtension($Video)
|
||||||
$outputDir = Split-Path -Parent $VideoPath
|
$outputDir = Split-Path -Parent (Resolve-Path -LiteralPath $VideoPath).Path
|
||||||
$Images = Join-Path $outputDir 'Frames' ($videoBaseName + '_%04d.png')
|
$Images = Join-Path $outputDir 'Frames' ($videoBaseName + '_%04d.png')
|
||||||
} else {
|
} else {
|
||||||
$outputPattern = $Images
|
$outputPattern = $Images
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ This environment variable must be set for both `rife-ncnn-vulkan` and `upscayl-b
|
|||||||
The value stored in **NCNN_GPU_ID** will be either:
|
The value stored in **NCNN_GPU_ID** will be either:
|
||||||
|
|
||||||
- **`0`** — use the first Vulkan-capable GPU (device index 0). If you have multiple GPUs, they'd be `0`, `1`, `2`, etc.
|
- **`0`** — use the first Vulkan-capable GPU (device index 0). If you have multiple GPUs, they'd be `0`, `1`, `2`, etc.
|
||||||
- **`-1`** — use CPU only (no Vulkan GPU is available).
|
- **`-1`** — use CPU only for `rife-ncnn-vulkan` (no Vulkan GPU is available). `upscayl-bin` rejects `-g -1` on the tested build, so the scripts omit its `-g` flag for `-1`, and it then uses its default device.
|
||||||
|
|
||||||
These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` and `upscayl-bin`:
|
These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` and `upscayl-bin`:
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` a
|
|||||||
| `0` | First GPU |
|
| `0` | First GPU |
|
||||||
| `1` | Second GPU |
|
| `1` | Second GPU |
|
||||||
| `2` | Third GPU |
|
| `2` | Third GPU |
|
||||||
| `-1` | CPU |
|
| `-1` | CPU for `rife-ncnn-vulkan`; no `-g` flag for `upscayl-bin` (its default device) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ The output format is selected from the `-Target` file extension. Each format has
|
|||||||
- AVIF output uses `libaom-av1` with `-still-picture 1` and `-cpu-used 4` for a reasonable speed/quality tradeoff. Your ffmpeg build must include `libaom-av1` for `.avif` output to work.
|
- AVIF output uses `libaom-av1` with `-still-picture 1` and `-cpu-used 4` for a reasonable speed/quality tradeoff. Your ffmpeg build must include `libaom-av1` for `.avif` output to work.
|
||||||
- `-Metadata` toggles ffmpeg's `-map_metadata 0` (copy) vs `-map_metadata -1` (strip). Which metadata actually survives the conversion depends on what the source and target formats can carry.
|
- `-Metadata` toggles ffmpeg's `-map_metadata 0` (copy) vs `-map_metadata -1` (strip). Which metadata actually survives the conversion depends on what the source and target formats can carry.
|
||||||
- `-LTX` only takes effect when `-Size` is `HD`, `1080p`, `720p` or `480p`. Combining it with any other `-Size` value (or omitting `-Size`) is rejected with an explicit error so the user is never silently downgraded to the regular preset.
|
- `-LTX` only takes effect when `-Size` is `HD`, `1080p`, `720p` or `480p`. Combining it with any other `-Size` value (or omitting `-Size`) is rejected with an explicit error so the user is never silently downgraded to the regular preset.
|
||||||
- `-Upscale` runs `upscayl-bin.exe` **before** ffmpeg. The script validates that `upscayl-bin.exe` is on PATH, that `UPSCAYL_HOME` is set and exists, that the `models` subfolder and the requested `<Model>.bin` / `<Model>.param` files are present, and that `NCNN_GPU_ID` is set to a valid integer (`-1` for CPU, `0+` for GPU). The intermediate upscaled PNG is created under `%TEMP%` and deleted after the run (including on ffmpeg failure).
|
- `-Upscale` runs `upscayl-bin.exe` **before** ffmpeg. The script validates that `upscayl-bin.exe` is on PATH, that `UPSCAYL_HOME` is set and exists, that the `models` subfolder and the requested `<Model>.bin` / `<Model>.param` files are present, and that `NCNN_GPU_ID` is set to a valid integer (`0+` for a GPU index; `-1` omits the `-g` flag, so upscayl-bin uses its default device, which is not necessarily the CPU). The intermediate upscaled PNG is created under `%TEMP%` and deleted after the run (including on ffmpeg failure).
|
||||||
- `-Keep` saves the raw upscayl output (no cropping/scaling). When the `-Keep` extension is `.png`, the temp file is copied directly (no re-encode); for any other supported extension a separate ffmpeg invocation converts the PNG to the requested format with default quality settings (JPEG `-q:v 2`, WEBP `-quality 90`, AVIF `-crf 25`). `-Keep` is ignored with a warning if `-Upscale` is not specified.
|
- `-Keep` saves the raw upscayl output (no cropping/scaling). When the `-Keep` extension is `.png`, the temp file is copied directly (no re-encode); for any other supported extension a separate ffmpeg invocation converts the PNG to the requested format with default quality settings (JPEG `-q:v 2`, WEBP `-quality 90`, AVIF `-crf 25`). `-Keep` is ignored with a warning if `-Upscale` is not specified.
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ The filters used (for example `scale`, `crop`, `pad`, `hstack`, `vstack`, `selec
|
|||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| `RIFE_HOME` | Install folder of rife-ncnn-vulkan (the same folder as its `PATH` entry). Models are read from `%RIFE_HOME%\rife-v4.26`. | Folder path, e.g. `C:\tools\rife-ncnn-vulkan\` | [Stitch-InBetween.ps1](Stitch-InBetween.md) |
|
| `RIFE_HOME` | Install folder of rife-ncnn-vulkan (the same folder as its `PATH` entry). Models are read from `%RIFE_HOME%\rife-v4.26`. | Folder path, e.g. `C:\tools\rife-ncnn-vulkan\` | [Stitch-InBetween.ps1](Stitch-InBetween.md) |
|
||||||
| `UPSCAYL_HOME` | Install folder of upscayl-bin (the same folder as its `PATH` entry). Models are read from `%UPSCAYL_HOME%\models`. | Folder path | [Clone-Image.ps1](Clone-Image.md) with `-Upscale` |
|
| `UPSCAYL_HOME` | Install folder of upscayl-bin (the same folder as its `PATH` entry). Models are read from `%UPSCAYL_HOME%\models`. | Folder path | [Clone-Image.ps1](Clone-Image.md) with `-Upscale` |
|
||||||
| `NCNN_GPU_ID` | GPU device passed to the `-g` flag of rife-ncnn-vulkan and upscayl-bin. | `0`, `1`, `2`... (GPU index), `-1` (CPU only) | [Stitch-InBetween.ps1](Stitch-InBetween.md), [Clone-Image.ps1](Clone-Image.md) with `-Upscale` |
|
| `NCNN_GPU_ID` | GPU device passed to the `-g` flag of rife-ncnn-vulkan and upscayl-bin. | `0`, `1`, `2`... (GPU index), `-1` (CPU for rife-ncnn-vulkan; upscayl-bin gets no `-g` flag and uses its default device) | [Stitch-InBetween.ps1](Stitch-InBetween.md), [Clone-Image.ps1](Clone-Image.md) with `-Upscale` |
|
||||||
|
|
||||||
These must be persistent user or system variables. An agent shell may not inherit variables set only in an interactive session.
|
These must be persistent user or system variables. An agent shell may not inherit variables set only in an interactive session.
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ This environment variable must be set for both `rife-ncnn-vulkan` and `upscayl-b
|
|||||||
The value stored in **NCNN_GPU_ID** will be either:
|
The value stored in **NCNN_GPU_ID** will be either:
|
||||||
|
|
||||||
- **`0`** — use the first Vulkan-capable GPU (device index 0). If you have multiple GPUs, they'd be `0`, `1`, `2`, etc.
|
- **`0`** — use the first Vulkan-capable GPU (device index 0). If you have multiple GPUs, they'd be `0`, `1`, `2`, etc.
|
||||||
- **`-1`** — use CPU only (no Vulkan GPU is available).
|
- **`-1`** — use CPU only for `rife-ncnn-vulkan` (no Vulkan GPU is available). `upscayl-bin` rejects `-g -1` on the tested build, so the scripts omit its `-g` flag for `-1`, and it then uses its default device.
|
||||||
|
|
||||||
These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` and `upscayl-bin`:
|
These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` and `upscayl-bin`:
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ These map directly to the `-g` flag values accepted by both `rife-ncnn-vulkan` a
|
|||||||
| `0` | First GPU |
|
| `0` | First GPU |
|
||||||
| `1` | Second GPU |
|
| `1` | Second GPU |
|
||||||
| `2` | Third GPU |
|
| `2` | Third GPU |
|
||||||
| `-1` | CPU |
|
| `-1` | CPU for `rife-ncnn-vulkan`; no `-g` flag for `upscayl-bin` (its default device) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user