Map Animation Skill
Use real satellite imagery and real terrain to create map animations that follow a voiceover. Three tasks: script writing, video creation, and video editing.
Before starting, read two hard constraints (details in references/compliance.md):
- Do not draw national borders, province borders, or any administrative boundaries. Do not color countries or provinces. A wrong Chinese map is a "problem map"; posting maps online requires review anyway. When the user wants a national map, tell them to use the standard map from the Ministry of Natural Resources (bzdt.ch.mnr.gov.cn), display it as-is, and include the review number. This skill does not draw such boundaries.
- Use only real satellite imagery, not AI-generated "satellite images." AI-drawn rivers, coastlines, and city locations are often fabricated.
First time using, run node <skill directory>/scripts/setup.mjs: it checks Node, Chrome, ffmpeg, installs dependencies, and tests network and GPU. If anything is missing, follow its prompts to install, then run it again.
Project Folder
Create a folder under the user's current directory: MapAnimation/<Topic>/, one folder per video:
script.txt Narration, one sentence per line
sources.md Source for every number and statement
plan.md What visuals accompany each sentence
voice.mp3 User's voiceover (wav, m4a also accepted)
timings.json Start and end of each sentence in the audio (generated by align.mjs)
film.json Visual script (you write this)
data/ GeoJSON for routes, rivers, lakes
out/ Final video, subtitle file, still frames
1. Script Writing
User says "Write an X-second script about...". Rules are in references/writing.md; the most important ones:
- Each sentence should preferably contain a place name or a number: a place name means a camera shot, a number means a big on-screen label.
- Keep sentences under 20 characters, like natural speech; each sentence should answer the question left by the previous one.
- Roughly 4.5 characters per second: 40 seconds ≈ 180 characters, 12 to 15 sentences.
- Verify numbers first (search, at least one reliable source), write into
sources.md. If unverifiable, don't include. - If the topic touches borders, territorial matters, current politics, or military installations, rephrase or advise the user to change the topic.
After writing, show the script to the user, and also provide a plan.md: one line per sentence describing the visuals. Then tell the user next step:
Record the voiceover according to the script, pause half a second between sentences, put the recorded file into this folder (mp3, wav, m4a are all fine), then say "Use this voiceover to make the video."
2. Video Creation
User says "Use this voiceover to make the video" (may specify aspect ratio, e.g., "4:3 landscape" or "portrait"). Follow in order:
- Align timings:
node scripts/align.mjs project/voice.mp3 project/script.txt- Check the printed table. Sentences marked as "estimated" or "wrong pacing" are likely where there was no pause.
- If deviations are large, ask the user to pause more between those sentences and re-record; if small, you can hand-edit
timings.json.
- Find coordinates and data:
- Place coordinates:
node scripts/geocode.mjs "Place1" "Place2" --country cn(for locations in China add--country cn, otherwise it might look up Japanese places).- Searching for a city name returns the administrative center, not necessarily the city center; for the city center, search for "City People's Government" or a landmark in the city.
- For hard-to-find project names (e.g., "Taocha Canal Head"), try an alternative name, or retrieve the point from OSM data.
- Real lines like rivers, lakes, canals, railways:
- First
node scripts/osm.mjs find --bbox south,west,north,eastto find the exact name in a small area. - Then use
osm.mjs line …(line) orosm.mjs area …(lake, reservoir) to fetch.
- First
- Travel routes:
node scripts/route.mjs --via "A;B;C" --mode road|flight|straight. - All commands are documented at the top of each script.
- Place coordinates:
- Write film.json:
- Format in
references/film-spec.md, can adapt fromexamples/beijing-water/film.json. - Use time expressions like "sentence number" (
"s3","s3.end","s3+0.4"), so you don't have to recalculate after changing the audio.
- Format in
- Verify the route:
node scripts/render.mjs project/film.json --probe. It prints the camera position every half second and how many kilometers along the route, matching the narration: when a place is mentioned, the waterdrop should be right there. - Render still frames for review:
node scripts/render.mjs project/film.json --stills s1,s2.mid,s5,…- At least one per sentence, plus opening and closing.
- Look at
out/stills/contact_sheet.jpg, check against the "Visual Rules" below:- Is the place name in the right place?
- Are the characters overlapping each other or covering the route?
- Any blank areas, seams, or blurry spots?
- Are numbers and units correct?
- If problems, edit film.json and re-render until every frame is correct.
- Render the video:
node scripts/render.mjs project/film.jsonrenders at 1080p; for 4K add--4k.- To quickly preview the motion, use
--preview. - After rendering, run
node scripts/check.mjs project/out/video_name.mp4to check for blurry or dropped frames.
- Delivery:
- Tell the user where the final video is, its duration, and how long this render took.
- The subtitle file
out/video_name.srtcan be imported into editing software for adjustments. - The bottom-right corner already has automatic attribution of satellite image and data sources; do not remove them.
3. Video Editing
User says things like "Slow down the Yellow River part" or "Make the place name bigger":
- Only edit the corresponding parts in
film.json. - First render a few seconds of still frames for confirmation, then re-render the full video.
- Do not change anything else.
Visual Rules (Use these when composing shots)
Opening (Sentence 1)
- The first frame should be the beautiful subject: the lake, the city, the start of the route. Do not start with an empty view.
- Zoom around 9, pitch 50–60, camera slowly rotates 2–4 degrees.
- Highlight the subject with
areas, and the place name appears 0.3 seconds after sentence 1 starts.
Move Only One Thing at a Time
- When the camera is making a large movement, do not introduce new text simultaneously.
- Place names appear exactly when the narration says them, maximum two at a time.
- Numbers appear after the camera stabilizes, counting up from 0, finishing in 0.6–0.8 seconds.
Routes and Camera
- The route starts growing on the sentence that says "depart." The tip of the line has a glowing waterdrop.
- Use
draw's anchor points so the waterdrop reaches a certain place exactly when the narration mentions it, e.g.,["s13", "113.25,34.88"]. - When following the route, use
follow:- For long distances, zoom out (6.5–7.5) to show the whole journey;
- When arriving, zoom in (8.5–9.5);
- Set bearing to the direction of travel so the route grows upward on screen.
- For underground or tunnel sections, use
dashedlines; the waterdrop will automatically dim.
Clarity and No Seams
- When using Esri satellite imagery, default
maxzoomis 11; camera zoom should not exceed 9.5, so 4K output remains clear. - For close-ups of city blocks (zoom above 12):
- Set
"maxzoom": 16on the camera keyframes for that section; only that part uses high-resolution tiles, other shots unaffected; - Keep pitch below 40 to avoid visible seams between near and far photos;
- On the last keyframe of the close-up, set
"maxzoom"back to 11.
- Set
Non-Stop Ending
- After arrival, continue pushing the camera in slowly by about 0.5 zoom; the last keyframe should be at the end of the video.
- Leave 1.5 seconds at the end.
Aspect Ratio
- Default to 16:9 if user doesn't specify.
- For portrait mode (9:16), place text in the middle third of the screen (leaving at least 250 pixels above and below), and no text in the bottom-right corner.
Subtitles
- By default, do not burn subtitles into the video; only output an
.srtfile for the user to add in editing software. - If the user wants them burned in, set
"subtitles": true.
More pitfalls in references/pitfalls.md.
One-Sentence Test of Quality
- Every time a place is mentioned, that place lights up on screen, or the camera arrives there.
- Even on mute, the viewer can understand the story.
- No national borders, province borders, or AI-generated fake maps.