From cf41fb0ce5bb8713d94f8bfde856fa8479e309a7 Mon Sep 17 00:00:00 2001 From: Claude Toupin Date: Sun, 1 Nov 2026 22:00:25 -0500 Subject: [PATCH] Add comprehensive existing file handling documentation to Create-Clip.md, Create-PillarBox.md, Create-Turnaround.md and Get-LastFrame.md explaining ffmpeg -y replacement behavior and WhatIf safety recommendations, expand SKILL.md prerequisites section to clarify Windows 11-only platform support with pwsh.exe requirement and reorganize core vs optional tools with task-specific check guidance, update conventions section to add Frames/Frame syntax tables and .skip marker behavior details, replace safety --- skill/Create-Clip.md | 7 ++ skill/Create-PillarBox.md | 7 ++ skill/Create-Turnaround.md | 7 ++ skill/Get-LastFrame.md | 8 +++ skill/SKILL.md | 139 ++++++++++++++++++++++--------------- 5 files changed, 112 insertions(+), 56 deletions(-) diff --git a/skill/Create-Clip.md b/skill/Create-Clip.md index c6f1ebf..f605869 100644 --- a/skill/Create-Clip.md +++ b/skill/Create-Clip.md @@ -151,6 +151,13 @@ This applies to every accepted container (`.mp4`, `.webm`, `.mkv`), matching is # Creates: P01-Clip.skip.mp4 scaled to 480p ``` +## Existing Files + +An existing derived clip is **replaced** without a prompt. The clip is created by [Clone-Video.ps1](Clone-Video.md), which runs ffmpeg with `-y` and overwrites its target. + +- The `.skip` marker stays last in the name that is replaced. For `P01.skip.mp4` the file replaced is `P01-Clip.skip.mp4`, or `P01-Clip.skip.mp4` with `-Suffix`. +- Use `-WhatIf` first, or use a different `-Suffix`. + ## Safe Execution This script supports `-WhatIf` and `-Confirm` for safe execution (forwarded to `Clone-Video.ps1`): diff --git a/skill/Create-PillarBox.md b/skill/Create-PillarBox.md index 784592b..4b53b91 100644 --- a/skill/Create-PillarBox.md +++ b/skill/Create-PillarBox.md @@ -218,6 +218,13 @@ The same logic applies to a transposed 9:16 frame: # CRF 18 instead of default CRF 8 / source bitrate ``` +## Existing Files + +An existing `-Target` video is **replaced** without a prompt. ffmpeg runs with `-y`. + +- If ffmpeg fails, the target file is removed and the script stops with an error. This also removes a target that existed before the run, so the old file is lost. A partial file is not left behind. +- Use `-WhatIf` first, or write to a new name. + ## Safe Execution This script supports `-WhatIf` and `-Confirm` for safe execution: diff --git a/skill/Create-Turnaround.md b/skill/Create-Turnaround.md index 70cd643..39ea2de 100644 --- a/skill/Create-Turnaround.md +++ b/skill/Create-Turnaround.md @@ -240,6 +240,13 @@ cd C:\renders\CharacterA .\Create-Turnaround.ps1 -Source .\renders -Target turnaround.webp -Quality 1 -Compression 6 ``` +## Existing Files + +An existing `-Target` image is **replaced** without a prompt. ffmpeg runs with `-y`. + +- The folder that contains `-Target` must already exist. The script stops with an error instead of creating it. +- Use `-WhatIf` first, or write to a new name. + ## Safe Execution This script supports `-WhatIf` and `-Confirm` for safe execution: diff --git a/skill/Get-LastFrame.md b/skill/Get-LastFrame.md index b64af61..9f99143 100644 --- a/skill/Get-LastFrame.md +++ b/skill/Get-LastFrame.md @@ -104,6 +104,14 @@ Frame saved to: frame_0099.png # Creates: f_7.png ``` +## Existing Files + +An existing output PNG is **replaced** without a prompt. ffmpeg runs with `-y`. + +- When `-Image` contains a numbering token such as `%04d`, the file replaced is the **resolved** name, not the pattern. For example, `-Image f_%04d.png -Frame 3` writes and replaces `f_0003.png`. +- If the output folder does not exist, it is created. With `-WhatIf` it is only reported. +- Use `-WhatIf` first, or write to a new name. + ## Safe Execution This script supports `-WhatIf` and `-Confirm` for safe execution: diff --git a/skill/SKILL.md b/skill/SKILL.md index e05089b..13bdba4 100644 --- a/skill/SKILL.md +++ b/skill/SKILL.md @@ -5,15 +5,18 @@ description: Operates a collection of PowerShell 7 scripts that process video an # Video Processing PowerShell Scripts -A collection of PowerShell 7 scripts that wrap ffmpeg and ffprobe for video and image processing. Some scripts also call rife-ncnn-vulkan (frame interpolation) and upscayl-bin (AI upscaling). Each script has its own page in this documentation, linked from the catalog below. +A collection of PowerShell 7 scripts that wrap ffmpeg and ffprobe for video and image processing. Some scripts also call rife-ncnn-vulkan (frame interpolation) and upscayl-bin (AI upscaling). + +The per-script pages sit in the same folder as this file. Load a page only when you need its details, using the links in the catalog below. ## Prerequisites -- **Platform**: Windows 11 only. The scripts are tested on Windows 11 and nowhere else. Do not run them on Linux or WSL, because those platforms are not supported. +- **Platform**: Windows 11 only. The scripts are tested on Windows 11 and nowhere else. Linux and WSL are not supported. Run them with Windows PowerShell 7 (`pwsh.exe`). - **PowerShell 7+** (`pwsh`). Required by every script. -- **ffmpeg** and **ffprobe** on `PATH`. Most scripts need both. [Stitch-InBetween.ps1](Stitch-InBetween.md) needs only ffmpeg. [Get-FramesCount.ps1](Get-FramesCount.md), [Get-VideoInfo.ps1](Get-VideoInfo.md) and [Create-FullSubtitle.ps1](Create-FullSubtitle.md) need only ffprobe. -- **rife-ncnn-vulkan** on `PATH`, with `RIFE_HOME` set. Required by [Stitch-InBetween.ps1](Stitch-InBetween.md). See [RIFE installation guide](RIFE.md). -- **upscayl-bin** on `PATH`, with `UPSCAYL_HOME` set. Required by [Clone-Image.ps1](Clone-Image.md) when `-Upscale` is used. See [Upscalers installation guide](Upscalers.md). +- **Core tools**: **ffmpeg** and **ffprobe** on `PATH`. Most scripts need both. [Stitch-InBetween.ps1](Stitch-InBetween.md) needs only ffmpeg. [Get-FramesCount.ps1](Get-FramesCount.md), [Get-VideoInfo.ps1](Get-VideoInfo.md) and [Create-FullSubtitle.ps1](Create-FullSubtitle.md) need only ffprobe. +- **Optional tools**, needed only by specific scripts: + - **rife-ncnn-vulkan** on `PATH`, with `RIFE_HOME` set. Required by [Stitch-InBetween.ps1](Stitch-InBetween.md). See the [RIFE installation guide](RIFE.md). + - **upscayl-bin** on `PATH`, with `UPSCAYL_HOME` set. Required by [Clone-Image.ps1](Clone-Image.md) when `-Upscale` is used. See the [Upscalers installation guide](Upscalers.md). ## Environment Variables @@ -27,20 +30,20 @@ These must be persistent user or system variables. An agent shell may not inheri ## Check the Environment -Run these once before the first use in a session: +Run the core checks once before the first use in a session: ```powershell pwsh --version ffmpeg -version ffprobe -version -Get-Command rife-ncnn-vulkan -Get-Command upscayl-bin -"RIFE_HOME=$env:RIFE_HOME" -"UPSCAYL_HOME=$env:UPSCAYL_HOME" -"NCNN_GPU_ID=$env:NCNN_GPU_ID" ``` -If anything is missing or empty, **stop**. Tell the user exactly what is missing and point to [index.md](index.md) (prerequisites), [RIFE.md](RIFE.md) or [Upscalers.md](Upscalers.md). Do not install software or change environment variables without the user's approval. +Run the task-specific checks only when the task uses the script that needs them: + +- Stitch-InBetween.ps1: `Get-Command rife-ncnn-vulkan`, `$env:RIFE_HOME` and `$env:NCNN_GPU_ID`. +- Clone-Image.ps1 with `-Upscale`: `Get-Command upscayl-bin`, `$env:UPSCAYL_HOME` and `$env:NCNN_GPU_ID`. + +If a core check fails, or a check needed by the current task fails, **stop**. Tell the user exactly what is missing and point to [index.md](index.md) (prerequisites), [RIFE.md](RIFE.md) or [Upscalers.md](Upscalers.md). Do not install software or change environment variables without the user's approval. A missing optional tool must not block unrelated tasks such as clipping. ## Installation and Location @@ -51,7 +54,8 @@ If anything is missing or empty, **stop**. Tell the user exactly what is missing ## How to Run the Scripts -- Always call a script as `pwsh -NoProfile -File