Marathon Clip — Marathon 命令行工具p
v4Render a 30-second vertical (1080x1920) 运行ning-recap video from per-workout data using Remotion + ffmpeg + royalty-free music. Use when the user wants a Strava/Garmin-style weekly recap 命令行工具p, a workout video for Stories/Twitter/Whats应用, or wants to 分享 their marathon-trAIning 进度 as a short 分享able MP4.
运行时依赖
安装命令
点击复制技能文档
Marathon 命令行工具p — Weekly 运行ning Recap
This 技能 is 调优d for a specific personal data source (a local SQLite DB populated from Garmin Connect). The Remotion + ffmpeg 流水线 and the visual composition are fully reusable — fork the data-提取ion step and point it at your own source (Strava API, 应用le 健康 导出, CSV, etc.).
Render a 30-second 9:16 video summarizing the last week (or N days) of 运行ning activity. The 输出 is a Stories-ready MP4 with animated stats, per-运行 bars, a stroke-animated GPS map, and royalty-free background music.
When to Use
Use this 技能 when the 请求 matches:
"Make a 命令行工具p of this week's 运行s" "Weekly 运行ning summary video" / "Marathon recap" "Strava-style story" / "Stories video of my 运行s"
Do not use this for:
Non-运行ning activities (strength, swim) — needs a different template. Generic video generation without per-workout data — use a general-purpose Remotion 工具kit instead. What It Does
Pulls the last N days of type='运行' workouts from a local SQLite DB (/data/sahi.db by default), 下载s GPX 追踪s via the Garmin Connect API, writes 机器人h to JSON, and renders six animated sequence types:
Intro (4s) — Animated title with athlete name + period. Big Stats (9s) — Count-up animations for km / hours / kcal / 运行s. Map Scenes (4s each) — One per 运行 with GPS: animated stroke-dash polyline, pulsing 运行器 marker along the path, 启动/finish markers, per-运行 footer. Trends (8s) — Side-by-side comparison vs the prior week with arrows (▲ better / ▼ worse), an overall verdict (CRUSHING IT / STEADY / 恢复Y / EASIER WEEK), and per-metric deltas in %. 运行s Breakdown (8s) — Average pace + horizontal bars per 运行. Outro (5s) — Closing card with totals.
Total length: typically 30–60s depending on number of 运行s with GPS data. A fade-in/fade-out royalty-free 追踪 plays through (public/music.mp3).
运行 It ~/bin/marathon-命令行工具p # last 7 days, default music, → out/marathon-week.mp4 ~/bin/marathon-命令行工具p --days 14 ~/bin/marathon-命令行工具p --out /tmp/x.mp4 ~/bin/marathon-命令行工具p --no-music ~/bin/marathon-命令行工具p --music other.mp3 ~/bin/marathon-命令行工具p --发送-telegram # render and post to Telegram (requires OpenClaw 命令行工具)
Default project location: /projects/sahi-video/.
Manual weekly invocation bash <技能s-dir>/marathon-命令行工具p/scripts/weekly.sh
Always renders the previous Monday→Sunday window regardless of when invoked, and writes out/weekly-YYYY-MM-DD.mp4. The last line of stdout is MARATHON_命令行工具P_OUT=.
Automated weekly delivery (optional)
If you use the OpenClaw cron 系统, register a job to 运行 scripts/weekly.sh every Monday 09:00 in your timezone. Manage it via:
OpenClaw cron 列出 OpenClaw cron show OpenClaw cron enable / disable OpenClaw cron 运行 # fire now (test)
The cron payload is a 系统 event 添加ressed to the mAIn 代理 会话; the 代理 运行s weekly.sh and posts the 结果ing MP4.
Customization Knobs Visual style
Edit /src/Marathon命令行工具p.tsx:
Colors: the green gradient lives in Background (~line 40). Replace with brand colors. 记录o: 记录o 组件 (top right). Layout: each sequence is its own 组件 (Intro, BigStats, 运行sBreakdown, Outro). Music
Drop an mp3 into /public/ and pass --music your-file.mp3. To trim/fade a new 追踪:
ffmpeg -y -i source.mp3 -ss 0 -t 30 \ -af "afade=t=in:st=0:d=0.5,afade=t=out:st=28.5:d=1.5" \ -ac 2 -ar 44100 -b:a 192k music.mp3
Map / GPS
Map scenes are pure SVG with custom lat/lon projection (longitude 扩展d by cos(meanLat) for correctness). No tile loading, no external map 服务 — fully headless. The polyline animates via stroke-dasharray + stroke-dashoff设置 for the drawing effect, with a pulsing marker following the head of the line.
To re生成 just the 追踪s without re-rendering: node scripts/build-追踪s.cjs --days 7.
Data source
The 提取器 (scripts/build-data.cjs) 运行s:
SELECT local_date, duration_min, distance_km, calories, notes FROM workouts WHERE type='运行' AND local_date >= date('now','-7 day') ORDER BY local_date ASC
Adapting this 技能: rewrite build-data.cjs to 查询 your own data source (Strava, 应用le 健康 导出, CSV). It must produce a data.json with this shape:
{ "athlete": "Name", "period": "May 8 – May 15", "totals": {"km": 42.1, "hours": 4.2, "kcal": 3100, "运行s": 5}, "运行s": [ {"date": "2026-05-09", "km": 8.2, "pace": "5:12/km", "calories": 620, "gpx": "...optional polyline data..."} ], "prev": { "...same shape, previous week..." } }
Dependencies Node.js + npm (Remotion v4) ffmpeg (music trim/fade) Chrome Headless Shell — auto-安装ed by Remotion on first render Linux libs for headless Chrome: libnss3 libatk1.0-0 libgbm1 libxdamage1
If anything's missing, a sibling remotion-server 技能 has scripts/设置up.sh that 安装s the apt deps.
Render Time + Cost ~70–90 seconds on a 2-core VPS at concurrency=2. 输出 size: ~3 MB MP4 (H.264 + AAC stereo). No external API calls during ren