summaryrefslogtreecommitdiff
path: root/scripts/stabilize-video
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-12 14:41:18 +0300
committerPaul Buetow <paul@buetow.org>2026-07-12 14:41:18 +0300
commitc1062bce6ad73d25122b2d9b804ee92a9cfcb0eb (patch)
tree22897829558cca289afa52069710b07b6acda153 /scripts/stabilize-video
parent1cd64284693327002a97fa5531f9e2dc92168efb (diff)
scripts: stabilize-video — fix EXIT trap unbound var under set -u
trf_dir was declared local in main(), so the EXIT trap referencing it fired after main returned — under set -u that became an unbound variable error and the script exited non-zero even though stabilization succeeded. Hoist trf_dir to script scope and guard the trap.
Diffstat (limited to 'scripts/stabilize-video')
-rwxr-xr-xscripts/stabilize-video4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/stabilize-video b/scripts/stabilize-video
index 0647a36..4490ec8 100755
--- a/scripts/stabilize-video
+++ b/scripts/stabilize-video
@@ -14,6 +14,7 @@
set -euo pipefail
VADEVICE="/dev/dri/renderD128"
+trf_dir="" # set by main; cleaned up by EXIT trap
QUALITY="${QUALITY:-34}" # HEVC CQP quality (higher = smaller)
SHAKINESS="${SHAKINESS:-5}" # vidstab shakiness 1..10
ACCURACY="${ACCURACY:-15}" # vidstab accuracy 1..15
@@ -92,9 +93,8 @@ main() {
# Build the work list, skipping clips whose output already exists.
local -a todo=()
- local trf_dir
trf_dir=$(mktemp -d -t stabilize-video.XXXXXX)
- trap 'rm -rf "$trf_dir"' EXIT
+ trap '[[ -n "$trf_dir" ]] && rm -rf "$trf_dir"' EXIT
for src in "${_mov_files[@]}"; do
local out