[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116597":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":29,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":15,"starSnapshotCount":15,"syncStatus":17,"lastSyncTime":33,"discoverSource":34},116597,"strava-home-runs","AlFontal\u002Fstrava-home-runs","AlFontal","Animate every run\u002Factivity that started from a particular radius as a 3D video (Blender).","",null,"Python",55,7,53,0,1,2,3,45.91,"MIT License",false,"main",true,[25,26,27,28],"garmin","gis","gpx","strava","2026-11-18 20:16:33","2026-11-23 12:45:23","# strava-home-runs\n\n[![tests](https:\u002F\u002Fgithub.com\u002FAlFontal\u002Fstrava-home-runs\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FAlFontal\u002Fstrava-home-runs\u002Factions\u002Fworkflows\u002Ftests.yml)\n![Python 3.11+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.11%2B-blue)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-green)](LICENSE)\n\nTurns GPX, TCX or FIT files (from Strava, Garmin or any other GPS source) into a 3D video of every run that started within a chosen radius of one point. It generalizes the script I used to animate five years of runs that started from my home.\n\n\u003Cp align=\"center\">\u003Cimg src=\"docs\u002Fpreview.webp\" alt=\"Animation of 289 runs leaving the same point in Barcelona, each at its own pace, with a clock and a histogram of finish times\" width=\"320\">\u003C\u002Fp>\n\nAll runs leave at the same moment and each one moves at its real pace. Routes you run often glow brighter, like a heat map. A clock, a \"still running\" counter and a histogram of finish times fill in as runners get home. The runner marker can be a cut-out of your face.\n\nThe map uses streets, lakes and rivers from OpenStreetMap and elevation from AWS Terrain Tiles, and is rendered in Blender. No API keys are needed.\n\n## Requirements\n\n- [pixi](https:\u002F\u002Fpixi.sh), which installs Python, the Python packages and ffmpeg into a local environment.\n- [Blender](https:\u002F\u002Fwww.blender.org\u002Fdownload\u002F) 5.0 or newer (tested with 5.2), installed separately.\n\n\u003Cdetails>\n\u003Csummary>macOS (Homebrew)\u003C\u002Fsummary>\n\n```bash\nbrew install pixi\nbrew install --cask blender\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Linux\u003C\u002Fsummary>\n\n```bash\ncurl -fsSL https:\u002F\u002Fpixi.sh\u002Finstall.sh | sh\nsudo snap install blender --classic   # or the tarball from blender.org\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Windows (PowerShell)\u003C\u002Fsummary>\n\n```powershell\nwinget install prefix-dev.pixi\nwinget install BlenderFoundation.Blender\n```\n\n\u003C\u002Fdetails>\n\nThe tool looks for Blender on your `PATH` and in `\u002FApplications\u002FBlender.app`; `--blender \u002Fpath\u002Fto\u002Fblender` points it elsewhere. [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) also works (`uv run homeruns ...`) if ffmpeg is on your `PATH`.\n\n## Getting your files\n\n- **Strava:** Settings → My Account → Download or Delete Your Account → Request your archive. Use the `activities\u002F` folder from the zip.\n- **Garmin Connect:** Account → Data Management → Export Your Data. The FIT files are in zip files inside the export; unzip those too.\n\nThe tool reads `.gpx`, `.tcx` and `.fit` files, gzipped or not, and searches folders recursively.\n\n## Usage\n\nRun it from this folder. The first `pixi run` sets up the environment.\n\n```bash\npixi run homeruns ~\u002FDownloads\u002Fstrava_export\u002Factivities --face me.png --place Lisbon --preview\n```\n\n`--preview` renders a half-size version in a few minutes. When it looks right, run the same command without `--preview` for the full 1440×2560 video. On an Apple Silicon Mac that takes about 1.5 hours (5 s per frame).\n\n`--face` takes a PNG or WebP of a face on a transparent background. On macOS and iOS, \"Copy Subject\" in Photos makes one. The face is tinted orange; `--tint 0` keeps its colours. Without `--face`, each runner is an orange dot.\n\n`pixi run homeruns --help` lists all options.\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Options\u003C\u002Fb>\u003C\u002Fsummary>\n\n| Option | Default | |\n|---|---|---|\n| `--title`, `--subtitle` | `HOME RUNS since \u003Cyear>`, `\u003Cn> runs, \u003Ctotal> km` | Text at the top; can use `{runs}`, `{km}`, `{first_year}`, `{last_year}` |\n| `--place` | | Added to the default subtitle |\n| `--credit` | | Extra line under the map credit, e.g. `\"Running & editing: Your Name\"` |\n| `--radius` | 200 | Metres from home a run must start within |\n| `--home` | auto | `lat,lon` of home |\n| `--since`, `--until` | | Date range, `YYYY-MM-DD` |\n| `--sport` | `run` | Keep tracks whose type contains this; `any` keeps all |\n| `--seconds` | 30 | Video seconds until the longest run finishes |\n| `--size` | `1440x2560` | Output size; the layout is made for 9:16 |\n| `--layout` | `vertical` | `feed`: 4:5 crop (1440×1800) for LinkedIn or Instagram feeds. `shorts`: 9:16 with the text clear of the YouTube Shorts, Reels and TikTok buttons and caption. Works with `--overlay-only` |\n| `--style` | `dark` | Map style of the video: `dark`, `blueprint`, or the light `paper` and `mono` (see Still images) |\n| `--privacy-radius` | 0 | Cut this many metres around home from every track |\n| `--no-sea` | | Don't treat land at sea level as sea (needed in places like the Netherlands); lakes and rivers from OpenStreetMap are still drawn |\n| `--line-strength` | auto | Brightness of a single route |\n| `--crf` | 16 | Video quality; higher gives a smaller file |\n| `--font-title`, `--font-text`, `--font-clock` | system fonts | TTF\u002FOTF files |\n| `--stills` | | Also render still images of the finished heat map in `dark`, `blueprint`, `paper` and\u002For `mono` (no value: all) |\n| `--no-video` | | Skip the video, e.g. to only make `--stills` |\n| `--keep-frames` | | Keep the rendered PNGs in the work folder |\n| `--overlay-only` | | Redraw the text on kept frames and encode, without Blender |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Pipeline details\u003C\u002Fb>\u003C\u002Fsummary>\n\n1. Reads every track and keeps the runs (`--sport`). Files without a type are kept.\n2. Finds home, the place where most runs start (or `--home lat,lon`), and keeps the runs that start within `--radius` metres.\n3. Cleans the GPS: drops spikes faster than `--max-speed` (7 m\u002Fs), cuts a track where the signal is lost for good (in the metro, for example) and shortens long pauses.\n4. Downloads elevation, streets, lakes and rivers for the area and caches them in `--work` (default `.homeruns\u002F`).\n5. Renders the scene in Blender, adds the text overlay and writes `home_runs.mp4` and `home_runs_final.png`.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Title and overlay details\u003C\u002Fb>\u003C\u002Fsummary>\n\nThe title and subtitle can use `{runs}`, `{km}` (total distance), `{first_year}` and `{last_year}`, with Python format specs after a colon:\n\n```bash\npixi run homeruns ~\u002FDownloads\u002Fstrava_export\u002Factivities --title \"All my runs from home since {first_year}\" \\\n    --subtitle \"{runs} runs, {km:.0f} km, Lisbon\"\n```\n\nThe distance is measured on the cleaned tracks after `--privacy-radius`, so it can be a little lower than Strava's total.\n\n\n\u003Cb>Changing the text without rendering again\u003C\u002Fb>\n\nThe text, clock and histogram are drawn after Blender renders the frames. Render with `--keep-frames` (a few GB at full size), and `--overlay-only` can redo the text in a few minutes without Blender:\n\n```bash\npixi run homeruns ~\u002FDownloads\u002Fstrava_export\u002Factivities --face me.png --place Lisbon --keep-frames\npixi run homeruns --overlay-only --title \"MY HOME RUNS\" --place Lisbon\n```\n\n`--overlay-only` takes no track files. It reads everything from the work folder, so pass the same `--work` (and `--preview` for preview frames). It accepts the text, font, `--credit`, `--layout`, `--out` and `--crf` options. Changes to the 3D scene, such as the map, routes, camera, marker, `--style` or `--seconds`, need a full render. Frames kept before `{km}` was added don't store distances, so `{km}` can't be filled for them.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Still images\u003C\u002Fb>\u003C\u002Fsummary>\n\n`--stills` also renders the finished heat map, without the text, as PNG images in four map styles: `dark` (the video's look), `blueprint` (blue), and `paper` and `mono` (light maps with the routes drawn like ink). Each is a single frame at twice the video size, cropped to the map, so it takes seconds. The same styles work for the video with `--style`, and the text and histogram follow the style's colours.\n\n| `dark` | `blueprint` |\n|---|---|\n| \u003Cimg src=\"docs\u002Fstill_dark.webp\" alt=\"Heat map of 289 Barcelona runs in the dark style: orange routes glowing on a night map\" width=\"400\"> | \u003Cimg src=\"docs\u002Fstill_blueprint.webp\" alt=\"The same heat map in the blueprint style: blue routes glowing on a dark blue map\" width=\"400\"> |\n| **`paper`** | **`mono`** |\n| \u003Cimg src=\"docs\u002Fstill_paper.webp\" alt=\"The same heat map in the paper style: dark red routes on a cream map with blue sea and rivers\" width=\"400\"> | \u003Cimg src=\"docs\u002Fstill_mono.webp\" alt=\"The same heat map in the mono style: black routes on a light grey map\" width=\"400\"> |\n\nWith `--no-video` you get only the images:\n\n```bash\npixi run homeruns ~\u002FDownloads\u002Fstrava_export\u002Factivities --stills --no-video         # all four styles\npixi run homeruns ~\u002FDownloads\u002Fstrava_export\u002Factivities --stills paper,mono --no-video\n```\n\nThey are named after `--out`: `home_runs_\u003Cstyle>.png` by default, or `home_runs_preview_\u003Cstyle>.png` (at video size) with `--preview`. `--stills` takes an optional value, so put it after the files (or write `--stills=paper`).\n\n\u003C\u002Fdetails>\n\n## Privacy\n\nThe video starts at your chosen location and every run leaves from it, and the still images show the same routes, so both can show where you live. `--privacy-radius 300` cuts the first and last 300 m of every track, like Strava's privacy zones, so runners appear at the edge of the circle. With many runs the centre can still be estimated, so don't publish the video or the images if your address must stay private.\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>How it works\u003C\u002Fb>\u003C\u002Fsummary>\n\n- **Timing:** the clock starts slowly and speeds up exponentially, so the busy first minutes are readable and the long runs don't drag.\n- **Camera:** at every frame, it finds the closest position at which everything drawn so far fits between the title and the clock.\n- **Heat:** routes render additively in a separate view layer, and the compositor maps the sum onto a heat colour ramp.\n- **Marker:** each face is a camera-facing card at the head of its route.\n\nThe code is in `homeruns\u002F`:\n\n| File | Role |\n|---|---|\n| `tracks.py` | Reads GPX\u002FTCX\u002FFIT, finds home, cleans GPS |\n| `basemap.py` | Downloads elevation, streets, lakes and rivers |\n| `prepare.py` | Builds the street texture and route points |\n| `scene.py` | Builds the scene in Blender |\n| `render_setup.py` | Render settings and the video's map style |\n| `styles.py` | Colours of the map styles |\n| `restyle.py` | Recolours the scene in a map style |\n| `stills.py` | Renders the last frame for still images |\n| `overlay.py` | Text, histogram and encoding; crops the still images |\n| `timewarp.py` | Clock curve |\n| `face.py` | Face and dot marker sprites |\n| `__main__.py` | Command line and pipeline |\n\nTests for track reading, cleaning, the map cache, lake and river outlines and the clock curve are in `tests\u002F` and run with `pixi run test` (or `uv run pytest`). They don't include Blender.\n\n\u003C\u002Fdetails>\n\n## Credits\n\n- Map data © [OpenStreetMap](https:\u002F\u002Fwww.openstreetmap.org\u002Fcopyright) contributors (ODbL). The video and the still images carry this credit.\n- Elevation from [AWS Terrain Tiles](https:\u002F\u002Fregistry.opendata.aws\u002Fterrain-tiles\u002F) (SRTM, GMTED, NED and other sources).\n- Strava is a trademark of Strava, Inc. and Garmin is a trademark of Garmin Ltd. This project is not affiliated with or endorsed by either.\n\n## License\n\nMIT\n","strava-home-runs 是一个将个人运动轨迹数据（GPX\u002FTCX\u002FFIT格式）可视化为3D动画视频的工具。它基于地理坐标筛选起点位于指定半径范围内的所有跑步活动，使用OpenStreetMap路网、AWS地形高程数据和Blender渲染引擎，生成包含真实速度、热力强度（高频路线更亮）、实时计时器、完赛时间直方图及可选人脸标记的三维运动动画。项目无需API密钥，支持本地离线处理，适用于运动爱好者复盘长期训练轨迹、地理行为分析或制作个性化运动纪念视频。","2026-11-24 04:53:59","CREATED_QUERY"]