mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
8071096a99
* Docs: refresh every UI screenshot, GIF and video from the current UI Re-record the README demo, the rover build, the sample plate and the class-A surface pictures with 0.22.1 in the default dark theme. The demo script is fixed for the current sketch dimension boxes and MCP file limits, and the rover replay and class-A pictures now have scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: cut the idle time out of the demo and rover recordings The README demo plays at 6x and the rover replay at 15x with a constant-rate camera orbit, with the stretches where nothing on screen changes cut out by the new trim_idle.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.8 KiB
Bash
Executable File
30 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# record_rover.sh DISPLAY PORT DESIGN OUTDIR [PLAYBACK_RATE]: record rover_replay.py replaying DESIGN's
|
|
# timeline in the app on X display DISPLAY (1920x1080, started with --control PORT) to
|
|
# OUTDIR/rover-build.mp4 (H.264) and .gif, accelerated PLAYBACK_RATE times (default 15) with the idle
|
|
# stretches cut (trim_idle.py).
|
|
# SOLIDCRAFT_DEMO_GIF_WIDTH and SOLIDCRAFT_DEMO_GIF_FPS size the GIF (default 800 px, 10 fps).
|
|
set -e
|
|
DISP=${1:-:0}; PORT=${2:-7878}; DESIGN=$3; OUT=$(cd "${4:-.}" && pwd); RATE=${5:-15}
|
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
NAME=${SOLIDCRAFT_DEMO_NAME:-rover-build}
|
|
GIF_WIDTH=${SOLIDCRAFT_DEMO_GIF_WIDTH:-800}
|
|
GIF_FPS=${SOLIDCRAFT_DEMO_GIF_FPS:-10}
|
|
ffmpeg -loglevel info -nostats -y -f x11grab -draw_mouse 0 -video_size 1920x1080 -framerate 30 -i "$DISP" \
|
|
-c:v libx264 -preset veryfast -crf 16 -pix_fmt yuv420p "$OUT/raw.mp4" 2> "$OUT/ffmpeg.log" &
|
|
FF=$!
|
|
trap 'kill -INT $FF 2>/dev/null || true; wait $FF 2>/dev/null || true' EXIT
|
|
sleep 1
|
|
python3 "$HERE/rover_replay.py" --port "$PORT" "$DESIGN" | tee "$OUT/replay.log"
|
|
sleep 3
|
|
kill -INT $FF; wait $FF || true
|
|
FSTART=$(grep -o "start: [0-9.]*" "$OUT/ffmpeg.log" | head -1 | cut -d" " -f2)
|
|
A=$(awk '/^start/{print $2}' "$OUT/replay.log"); B=$(awk '/^end/{print $2}' "$OUT/replay.log")
|
|
SS=$(python3 -c "print(max(0,$A-$FSTART-0.5))"); TO=$(python3 -c "print($B-$FSTART+1.5)")
|
|
ffmpeg -loglevel error -y -ss "$SS" -to "$TO" -i "$OUT/raw.mp4" -an -c:v libx264 -preset veryfast -crf 14 -pix_fmt yuv420p "$OUT/real-time.mp4"
|
|
python3 "$HERE/trim_idle.py" "$OUT/real-time.mp4" "$OUT/$NAME.mp4" --rate "$RATE" --crf 23
|
|
ffmpeg -loglevel error -y -i "$OUT/$NAME.mp4" \
|
|
-vf "fps=$GIF_FPS,scale=$GIF_WIDTH:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=96:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" \
|
|
"$OUT/$NAME.gif"
|
|
ls -la "$OUT/$NAME.mp4" "$OUT/$NAME.gif"
|