MEGA-WEBSITE/app/scripts/make-placeholder.sh
Dave b75229a5f4 Mega Infrastructure website: cinematic scroll redesign
Vite + React + Tailwind site with a scroll-scrubbed drone fly-through,
services, projects, company, team and contact sections, plus a
Dockerfile + nginx config for Coolify deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:24:49 +02:00

42 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Builds a placeholder "fly-through" from Mega's own drone stills (slow push-ins + crossfades).
# Replace with real drone / AI footage later: just run make-frames.sh on the new clip.
#
# Usage: scripts/make-placeholder.sh <photos-dir> <out.mp4>
set -euo pipefail
SRC=${1:?photos dir}
OUT=${2:?output mp4}
# Story order — each shot maps to a chapter of the scroll scene.
SHOTS=(
"Thabzimbi-Square-16.jpg" # 01 hero: high, wide, mountains
"DJI_0587-Edit.jpg" # 02 bulk earthworks: excavator in the cut
"3415e91b-24eb-4d02-9ccf-2804afeecdb7.jpg" # 03 roads: asphalt going down
"cd309202-9a22-40ba-ac62-c46acc80119e.jpg" # 03 roads: grader on layerworks
"DJI_0528-Edit.jpg" # 04 municipal + stormwater: pipe trench
"Spark-2.jpg" # 05 finished: delivered precinct
)
FPS=24; LEN=40; FADE=10 # frames per shot / crossfade frames
inputs=(); filters=""; i=0
for s in "${SHOTS[@]}"; do
inputs+=(-i "$SRC/$s")
# crop to 16:9, upscale for jitter-free zoompan, then slow push-in (alternating drift)
dx=$([ $((i % 2)) -eq 0 ] && echo "iw/2-(iw/zoom/2)+on*1.2" || echo "iw/2-(iw/zoom/2)-on*1.2")
filters+="[$i:v]scale=3840:2160:force_original_aspect_ratio=increase,crop=3840:2160,"
filters+="zoompan=z='1+0.0045*on':x='$dx':y='ih/2-(ih/zoom/2)':d=$LEN:s=1920x1080:fps=$FPS,setsar=1,format=yuv420p[s$i];"
i=$((i + 1))
done
# chain crossfades
prev="s0"; offset=0
for ((k = 1; k < i; k++)); do
offset=$(printf "%.4f" "$(echo "$offset + ($LEN - $FADE) / $FPS" | bc -l)")
filters+="[$prev][s$k]xfade=transition=fade:duration=$(printf "%.4f" "$(echo "$FADE / $FPS" | bc -l)"):offset=$offset[x$k];"
prev="x$k"
done
filters=${filters%;}
ffmpeg -loglevel error -y "${inputs[@]}" -filter_complex "$filters" -map "[$prev]" \
-c:v libx264 -preset slow -crf 18 -g 1 -pix_fmt yuv420p -movflags +faststart "$OUT"
echo "wrote $OUT"