edu-math-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese数学题讲解视频 (edu-math-video)
Math Problem Explainer Video (edu-math-video)
把一道数学题做成 16:9、1920×1080、带中文配音 + 中英双语字幕 + 手绘笔记本风格动画的 MP4。
流水线(每个视频一个文件夹):
script.json ──build_audio.py──► build/timeline.json + build/mix.wav + ../<name>.srt
(旁白) (GLM-TTS + 合成音乐) │
anim.js + engine.js ◄─────────────────────────┘ (按旁白时间点驱动动画)
└──node render.mjs video──► ../<name>.mp4核心原则:画面跟着旁白走,而且图会"讲题"。 每句旁白,图上都有一个动作把这句推理演出来(线段滑过去重合、三角形叠上去、相机转到俯视、动点移动……),不是只多出一条线、一个标签。每个动画都用"第 k 句旁白开始的时刻" 定时,绝不写死秒数。
S.at(k, f)本技能自带全部代码,不要从别的项目复制文件:
- :可直接运行的完整示例项目(直角三角形斜边中线题)。
template/是通用引擎(不改),engine.js/anim.js/script.json/episode.json是每道题都要重写的。problem.png - +
shared/pron.py:读音控制(GLM-TTS 没有 SSML/拼音输入)。shared/pron.json - :立体几何完整示例(anim.js + storyboard.md + script.json):相机斜视↔俯视、侧面展开成扇形、内错角旋转、平面平移。做立体几何、圆、多问题时先读它。
examples/cone-parallel/ - :
scripts/(建项目)、new_video.sh(查环境)、setup_check.sh(文字题→图片+高亮框)、make_problem_png.py(截图→高亮框坐标)、problem_boxes.py(截图拼图审查)。contact_sheet.py
下文 = 本文件所在目录, = 用户当前所在的目录(你的工作目录,):视频文件夹建在这里,mp4/srt 也输出到这里。不要因为别的目录(包括本技能所在的项目)已经有 、、 就把 WS 换过去,缺什么由 和第 2 步补齐。 = 本视频文件夹, = 报告的 python(macOS 上一般是 ;PATH 里的 可能没有 numpy)。
SKILLWS$PWD.envnode_modulespron.jsonnew_video.shPROJPYsetup_check.sh/usr/bin/python3python3Turn a math problem into a 16:9, 1920×1080 MP4 with Chinese voice-over, bilingual Chinese-English subtitles, and hand-drawn notebook-style animation.
Pipeline (one folder per video):
script.json ──build_audio.py──► build/timeline.json + build/mix.wav + ../<name>.srt
(旁白) (GLM-TTS + 合成音乐) │
anim.js + engine.js ◄─────────────────────────┘ (按旁白时间点驱动动画)
└──node render.mjs video──► ../<name>.mp4Core principle: the visuals follow the voice-over, and the graphics themselves “explain the problem.” For every narration line, an on-screen action performs the reasoning expressed by that line (a segment slides over until it overlaps, a triangle is overlaid, the camera rotates to a top-down view, a moving point travels, and so on); it is not enough to merely add one more line or label. Every animation is scheduled using “the moment narration line k begins,” , and never uses hard-coded seconds.
S.at(k, f)This skill includes all the code; do not copy files from another project:
- : a complete, directly runnable example project for the problem about the median to the hypotenuse of a right triangle.
template/is the general-purpose engine and must remain unchanged, whileengine.js,anim.js,script.json, andepisode.jsonmust be rewritten for every problem.problem.png - +
shared/pron.py: pronunciation control, because GLM-TTS does not accept SSML or pinyin input.shared/pron.json - : a complete solid-geometry example containing
examples/cone-parallel/,anim.js, andstoryboard.md: an angled camera view transitioning to a top-down view, a side unfolding into a sector, rotation to illustrate alternate interior angles, and translation across a plane. Read this first when working on solid geometry, circles, or multiple problems.script.json - :
scripts/(create a project),new_video.sh(check the environment),setup_check.sh(convert a text problem into an image with highlighted boxes),make_problem_png.py(extract highlighted-box coordinates from a screenshot), andproblem_boxes.py(create a contact sheet for screenshot review).contact_sheet.py
Below, = the directory containing this file, and = the user's current directory (your working directory, ). The video folder is created here, and the MP4 and SRT files are also output here. Do not switch to a different directory merely because another directory, including the project containing this skill, already has , , or . Fill any gaps with and Step 2. = the folder for this video, and = the Python executable reported by (on macOS this is generally ; the in PATH may not have numpy).
SKILLWS$PWD.envnode_modulespron.jsonnew_video.shPROJPYsetup_check.sh/usr/bin/python3python3必须遵守的规则
Mandatory Rules
退出码不是 0 就是没完成。 退出码 1(哪怕只剩一个 ⚠ 多音字)、 退出码 1、截图里有问题,都不能写"只是警告、不影响"然后继续。修好再往下走。
--checkmotion- 严格按下面 10 步顺序做,每步的"通过标准"满足了才能进入下一步。 不要跳步,不要"最后一起检查"。
- 先讲清楚题目。 视频第一幕必须展示原题图片(截图或 生成的图),旁白逐条读条件,每读一条就在图上框出那一条。
make_problem_png.py - 字段只能是能念出来的中文。 不能有阿拉伯数字、
tts等符号:= + − × ÷ / ^ √ ∠ △ ∥ ° ( )写成AC=3,AC等于三写成x²。字幕x的平方字段保留正常数学写法。zh会报错拦住。--check - 读音必须固定。 调 TTS 之前 必须显示
--check且未固定读音的生僻字/多音字: 0。多音字的标注写在该字后面:script errors: 0、长[cháng]。不能写成要[yào]求(那会把"点"读成 zhōng)。中点[zhōng] - API Key 只能由用户提供。 缺 时先问用户:配置 key(音质最好,推荐),还是用兜底引擎(edge-tts / macOS
GLM_API_KEY,见 reference/glm-tts-setup.md)。不要编造 key、模型名或接口地址,不要把 key 打印出来或写进项目文件夹。say - 所有画面内容在 y ≤ 860 以内(y≈914
1044 是字幕框)。图形放左半边 x 60900,推导文字写在右边的横线板上。board() - 先写分镜,再写动画。 给每句旁白规划"指/动/留",按 reference/visual-design.md 的动作表选动作;
storyboard.md必须通过。node render.mjs motion - 先预览再花钱。 用 +
--preview检查版面,没问题再跑真正的 TTS。stills auto - 看图验证。 每次渲染截图后都要打开 亲眼检查(用读图工具),不能只看命令有没有报错。汇报时写你实际看到了什么,不要凭印象全部打勾。
build/sheet.png - 不要修改 ,除非用户要求换风格;需要新图形就在
engine.js里写函数。anim.js - 不要把 、
node_modules复制进视频文件夹,依赖在package*.json根目录装一次,所有视频共享。WS
An exit code other than 0 means the task is incomplete. A exit code of 1, even if only one ⚠ polyphonic-character warning remains, a exit code of 1, or any problem visible in the screenshots means the work is not finished. Do not claim that an issue is merely a warning and does not affect the result. Fix it before continuing.
--checkmotion- Strictly follow the 10 steps below in order. Each step's acceptance criteria must be satisfied before proceeding to the next step. Do not skip steps or defer all checks until the end.
- Explain the problem clearly first. The first scene of the video must display the original problem image, whether it is a screenshot or generated by . The voice-over must read each condition one at a time, and the corresponding condition must be boxed on the image as it is read.
make_problem_png.py - The field may contain only Chinese text that can actually be spoken. It must not contain Arabic numerals or symbols such as
tts. Write= + − × ÷ / ^ √ ∠ △ ∥ ° ( )asAC=3, andAC等于三asx². The subtitle'sx的平方field retains normal mathematical notation.zhwill report an error and block the workflow.--check - Pronunciation must be deterministic. Before invoking TTS, must show
--checkand未固定读音的生僻字/多音字: 0. A polyphonic-character annotation must appear immediately after the relevant character:script errors: 0,长[cháng]. Do not write要[yào]求, because that causes 点 to be pronounced as zhōng.中点[zhōng] - Only the user may provide the API key. If is missing, first ask the user whether they want to configure a key for the best audio quality, which is recommended, or use a fallback engine such as edge-tts or macOS
GLM_API_KEY; see reference/glm-tts-setup.md. Do not invent a key, model name, or endpoint. Do not print the key or write it into the project folder.say - All visual content must remain within y ≤ 860. The area around y ≈ 914–1044 is reserved for subtitles. Place graphics in the left half at x 60–900, and write derivations on the ruled board on the right using .
board() - Create the storyboard before the animation. In , plan a “point/move/retain” action for every narration line and select actions from the table in reference/visual-design.md.
storyboard.mdmust pass.node render.mjs motion - Preview before spending money. Use together with
--previewto check the layout, and run the real TTS only after the preview is correct.stills auto - Verify the rendered images visually. After every rendering pass, open and inspect it with an image-reading tool. Do not rely only on whether the command reported an error. When reporting the results, describe what you actually saw rather than marking every item as passed based on assumptions.
build/sheet.png - Do not modify unless the user requests a different visual style. Implement new graphics as functions in
engine.js.anim.js - Do not copy or
node_modulesinto the video folder. Install dependencies once at thepackage*.jsonroot and share them across videos.WS
11 个步骤
The 11 Steps
第 1 步:弄清题目,自己先把题解对
Step 1: Understand the Problem and Solve It Correctly First
- 拿到题目文字(有截图就先读图)。先自己完整解一遍并验算,写下:已知条件清单、所求、关键思路(1~2 个)、每一步计算、最终答案、验算方法。
- 答案不确定或题目看不清时,问用户,不要猜。
- 通过标准: 你能用 3~6 个"幕"讲完,每一幕一句话说清目的;答案已验算。
- Obtain the problem text; if a screenshot is provided, read it first. Solve the entire problem yourself and verify the result, then record the list of given conditions, the target, the key idea or ideas (1–2), every calculation, the final answer, and the verification method.
- If the answer is uncertain or the problem is unreadable, ask the user rather than guessing.
- Acceptance criteria: You can explain the problem in 3–6 “scenes,” with one sentence per scene explaining its purpose, and the answer has been verified.
第 2 步:建项目、查环境
Step 2: Create the Project and Check the Environment
bash
bash SKILL/scripts/new_video.sh "$PWD" <ascii_folder_name> # WS 就是当前目录
bash SKILL/scripts/setup_check.sh WS/<ascii_folder_name>- 会把
new_video.sh/pron.py链接到技能自带的共享词表,并在找得到时把pron.json链接到已有安装(不复制);找不到才需要在node_modules下WS。python 包用npm install。PY -m pip install --user numpy requests pypinyin pillow - 报
new_video.sh说明你把 WS 设成了技能所在的项目,改用当前目录。ERROR: ... is where the skill is installed - 默认音色是 (锤锤),用户可以在
chuichui里用.env换。GLM_VOICE - 缺 :停下,按 reference/glm-tts-setup.md 引导用户配置(推荐放
GLM_API_KEY,所有目录通用),然后继续。不要去别的项目里找~/.config/math-problem-video/.env用,也不要因此换工作目录。 用户没有 key 或不想配:.env(默认)会自动改用兜底引擎,TTS_ENGINE=auto会显示用的是哪个;装 edge-tts 前先征得用户同意。setup_check.sh - 通过标准: 输出
setup_check.sh。ALL OK
bash
bash SKILL/scripts/new_video.sh "$PWD" <ascii_folder_name> # WS 就是当前目录
bash SKILL/scripts/setup_check.sh WS/<ascii_folder_name>- links
new_video.shandpron.pyto the skill's shared pronunciation dictionary and links to an existingpron.jsoninstallation when one can be found instead of copying it. Runnode_modulesundernpm installonly if no suitable installation is found. Install the Python packages withWS.PY -m pip install --user numpy requests pypinyin pillow - If reports
new_video.sh, it means WS was set to the skill's own project. Use the current directory instead.ERROR: ... is where the skill is installed - The default voice is (Chuichui). Users can change it with
chuichuiinGLM_VOICE..env - If is missing, stop and guide the user through the configuration described in reference/glm-tts-setup.md. The recommended location is
GLM_API_KEY, which works across all directories. Then continue. Do not look for a~/.config/math-problem-video/.envfile in another project, and do not change the working directory because the key is missing. If the user has no key or does not want to configure one,.env, which is the default, automatically switches to a fallback engine, andTTS_ENGINE=autoreports which engine is in use. Ask for permission before installing edge-tts.setup_check.sh - Acceptance criteria: prints
setup_check.sh.ALL OK
第 3 步:测试 TTS(验证 key 和音色)
Step 3: Test TTS and Verify the Key and Voice
bash
cd PROJ && PY build_audio.py --say "你好,我们来看一道数学题。"- 成功会打印 和
WROTE build/say_xxxx.wav(voice: .../edge:开头 = 兜底引擎)。401/403 = key 错或没余额,告诉用户,不要重试 10 次。say: - 第一次给这个用户做视频时,把这个 wav 路径告诉用户试听,确认音色(音色表见 glm-tts-setup.md)。
- 通过标准: 生成了 wav。
bash
cd PROJ && PY build_audio.py --say "你好,我们来看一道数学题。"- Success prints and
WROTE build/say_xxxx.wav. A voice beginning withvoice: ...oredge:indicates a fallback engine. A 401/403 response means the key is invalid or has no remaining balance. Tell the user rather than retrying ten times.say: - When creating the first video for a user, provide the WAV path so the user can audition the voice. The voice list is available in glm-tts-setup.md.
- Acceptance criteria: A WAV file is generated.
第 4 步:准备题目图片 problem.png
和高亮框
problem.pngStep 4: Prepare problem.png
and the Highlighted Boxes
problem.png二选一(细节见 reference/animation.md):
- 只有文字:,它直接输出
PY SKILL/scripts/make_problem_png.py --text "完整题目" --mark "条件1" "条件2" ... "所求" --out PROJ/problem.png。srcW/srcH/boxes - 有截图:复制到 ,必要时
PROJ/裁掉无关部分并存为problem_boxes.py crop;然后problem.png出坐标网格图,读出每个条件的像素框;再problem_boxes.py grid画框确认。problem_boxes.py check - 把尺寸和框填进 顶部的
anim.js。PROBLEM - 通过标准: 你打开了 或
*.preview.png,文字完整(没有 ☒/□ 方框),每个框都恰好罩住对应文字。*.check.png
Choose one of the following methods; see reference/animation.md for details:
- Text only: . The script directly outputs
PY SKILL/scripts/make_problem_png.py --text "完整题目" --mark "条件1" "条件2" ... "所求" --out PROJ/problem.png,srcW, andsrcH.boxes - Screenshot provided: Copy it into . If necessary, use
PROJ/to remove irrelevant content and save the result asproblem_boxes.py crop. Then useproblem.pngto generate a coordinate-grid image and read the pixel box for each condition. Finally, useproblem_boxes.py gridto draw and verify the boxes.problem_boxes.py check - Enter the dimensions and boxes at the top of in the
anim.jsobject.PROBLEM - Acceptance criteria: You have opened the or
*.preview.pngfile, the text is complete with no ☒ or □ placeholder glyphs, and every box covers exactly the corresponding text.*.check.png
第 5 步:写 episode.json
和 script.json
episode.jsonscript.jsonStep 5: Write episode.json
and script.json
episode.jsonscript.json按 reference/script-writing.md 写。要点:
- :
episode.json(视频标题)、title(输出文件名,如output_name)、斜边中线_Median_to_Hypotenuse(要加"啵"音效的幕)。pop_scenes - :幕的数组,每幕
script.json。第一幕{"scene": "英文id", "lines": [{"zh","tts","en"}, ...]}读题,最后一幕intro回顾 + 报答案。outro - 每句旁白 ≤ 36 个汉字宽(否则字幕折两行),一句只讲一件事。
- 通过标准: JSON 合法;每一幕的 id 都有计划好的画面。
Follow reference/script-writing.md. Key points:
- :
episode.json(video title),title(output filename, such asoutput_name), and斜边中线_Median_to_Hypotenuse(scenes that should include the “pop” sound effect).pop_scenes - : an array of scenes, where each scene has the form
script.json. The first scene,{"scene": "English ID", "lines": [{"zh","tts","en"}, ...]}, reads the problem, and the final scene,intro, reviews the solution and states the answer.outro - Each narration line must be no more than 36 Chinese-character widths wide; otherwise the subtitle wraps onto two lines. Each line should communicate only one idea.
- Acceptance criteria: The JSON is valid, and every scene ID has a planned visual composition.
第 6 步:写分镜 storyboard.md
storyboard.mdStep 6: Write the Storyboard storyboard.md
storyboard.md先读 reference/visual-design.md,再按 的格式给每句旁白写一行:。
template/storyboard.md| 幕id 句号 | 旁白要点 | 指 | 动 | 留 | 板书 |- "指":这句提到的元素怎么点亮。"动":图上一个体现推理的动作,从动作表里选(相等→复制滑过去重合,全等→三角形叠上去,立体↔平面→相机转动,求长度→数字计数……)。"留":动作后留下的标记。
- 除第一幕和最后一幕外,"动"不能空,也不能只写"出现/显示"。每幕至少一个连续运动。
- 先想清楚:只看图、不看板子,观众能不能看懂这一步为什么成立?不能就换动作。
- 先在 storyboard.md 顶部写图形清单:题目里所有的点、线段、平行/垂直/中点关系、已知长度,全部要画出来,位置按数据计算。
- 通过标准: 每句都有一行;图形清单完整;你能说出每一幕里"最能让人看懂"的那个动作。
Read reference/visual-design.md first, then follow the format in and write one row per narration line: .
template/storyboard.md| scene ID line number | narration point | point | move | retain | board notes |- “Point” describes how the element mentioned by the line is highlighted. “Move” describes one on-screen action that demonstrates the reasoning, selected from the action table (equal → copy and slide until it overlaps, congruent → overlay the triangles, solid ↔ planar → rotate the camera, find a length → count units, and so on). “Retain” describes the mark left after the action.
- Except for the first and final scenes, “Move” must not be empty and must not merely say “appears” or “is displayed.” Every scene must contain at least one continuous motion.
- First determine whether a viewer can understand why the step is valid by looking only at the graphics, without reading the board. If not, replace the action with a clearer one.
- At the top of , write the graphics inventory: every point, segment, parallel/perpendicular/midpoint relationship, and given length in the problem must be drawn, with positions calculated from the data.
storyboard.md - Acceptance criteria: Every narration line has a row, the graphics inventory is complete, and you can identify the action in each scene that makes that step easiest to understand.
第 7 步:读音与脚本检查,修到 0
Step 7: Check Pronunciation and the Script Until All Errors Are Resolved
bash
cd PROJ && PY build_audio.py --check ; cat build/pron_report.txt- 行:按提示改
ERROR(通常是 tts 里有数字/符号,或 anim.js 缺script.json;第 8 步写完 anim.js 前后者会报错,属正常)。SC.<id> - 行:按 reference/pronunciation.md 处理:该字后面加
⚠ 多音/生僻,或反复出现的词加进[拼音]的pron.json,确认默认读音正确的词加进words。ok - 通过标准: 且
未固定读音的生僻字/多音字: 0,退出码 0。script errors: 0
bash
cd PROJ && PY build_audio.py --check ; cat build/pron_report.txt- For an line, follow the instructions to fix
ERROR. This is usually caused by digits or symbols inscript.json, or by a missingttsinSC.<id>. The latter is expected before Step 8 and is not an error at that point.anim.js - For a line, follow reference/pronunciation.md. Add
⚠ 多音/生僻after the character, or add recurring words to the[pinyin]list inwords. Add words whose default pronunciation is already correct topron.json.ok - Acceptance criteria: ,
未固定读音的生僻字/多音字: 0, and the exit code is 0.script errors: 0
第 8 步:写 anim.js
anim.jsStep 8: Write anim.js
anim.js按 storyboard.md 逐句实现,API 见 reference/animation.md。先通读 (示例)再动手,结构保持一致:
template/anim.js- (第 4 步的数据)、
PROBLEM(每幕左上角标签)、图形函数(如TAGS)、fig(st)(每幕一个)。SC.<id> = (lt, S) => {...} - 每个元素的出现时间 = 旁白提到它的时刻:。
S.P(S.at(k, f), 时长) - 每句:点亮提到的元素 → 分镜里的动作(
glow(..., bump(lt, at(k)))、slideSeg、movePoly、动点、camTween…)→ 留下标记。countTo - 右侧 +
board()逐行写推导(与图同色),最后bl(行号, 文字, S.at(k, f), lt)盖章给答案。stamp() - 通过标准: 无 ERROR。
PY build_audio.py --check
Implement the storyboard line by line, using the API in reference/animation.md. Read the complete example in before starting, and preserve the same structure:
template/anim.js- (the data from Step 4),
PROBLEM(the tag in the upper-left corner of each scene), graphics functions such asTAGS, andfig(st)for each scene.SC.<id> = (lt, S) => {...} - Each element's appearance time must match the moment the narration mentions it: .
S.P(S.at(k, f), duration) - For every line: use to highlight the mentioned element, then perform the storyboard action, such as
glow(..., bump(lt, at(k))),slideSeg,movePoly, moving a point, orcamTween, and finally leave the resulting mark.countTo - On the right, use and
board()to write the derivation line by line in the same color as the corresponding graphic. Finally, usebl(line number, text, S.at(k, f), lt)to stamp the answer.stamp() - Acceptance criteria: reports no errors.
PY build_audio.py --check
第 9 步:免费预览:动作检查 + 版面检查
Step 9: Perform a Free Preview and Check Motion and Layout
bash
cd PROJ && PY build_audio.py --preview && node render.mjs motion && node render.mjs stills auto && PY SKILL/scripts/contact_sheet.py .- 在每句里取 6 帧,比较左半边图形区的变化:
motion(没变化)必须修;每幕至少一句STATIC。不通过就回到分镜换更好的动作,不要只加一个无意义的晃动来凑数。MOVE - 在每句旁白快结束时截一帧(此时这句该出现的东西都应在画面上)。命令输出
stills auto说明 anim.js 有 JS 错误,先修。FAILED: page error - 打开 (多于 12 张时是
build/sheet.png、sheet_1.png…)逐张检查,对照 reference/animation.md 的审查清单:没有重叠、没有出界、没有挡住字幕、每句提到的东西都画出来了、数值与解答一致。sheet_2.png - 有问题 → 改 anim.js → 重跑本步。
- 通过标准: ;全部截图检查通过(在回复里逐幕说明你看到了什么)。
motion check passed
bash
cd PROJ && PY build_audio.py --preview && node render.mjs motion && node render.mjs stills auto && PY SKILL/scripts/contact_sheet.py .- takes six frames from every narration line and compares changes in the graphics area on the left. Every
motionresult, meaning no visual change, must be fixed. Every scene must contain at least oneSTATIC. If the check fails, return to the storyboard and choose a better action; do not add a meaningless shake merely to pass the check.MOVE - captures a frame near the end of each narration line, by which time everything introduced by that line should be visible. A
stills automessage indicates a JavaScript error inFAILED: page errorand must be fixed.anim.js - Open and inspect it image by image. If there are more than 12 images, the files are named
build/sheet.png,sheet_1.png, and so on. Check each image against the reference/animation.md review checklist: there must be no overlaps, no out-of-bounds content, nothing blocking the subtitles, every mentioned element must be drawn, and all values must match the solution.sheet_2.png - If there is a problem, edit and rerun this step.
anim.js - Acceptance criteria: The output includes , and every screenshot passes review. In the response, describe what was actually observed in each scene.
motion check passed
第 10 步:真正生成配音,自动听写核对,再检查一次画面
Step 10: Generate the Real Voice-over, Verify It with ASR, and Recheck the Visuals
bash
cd PROJ && PY build_audio.py && PY build_audio.py --asr && node render.mjs stills auto && PY SKILL/scripts/contact_sheet.py .- TTS 按文本缓存在 ,改了某句只会重新合成那一句。
build/tts/ - 用智谱语音识别把每句配音转回文字,写入
--asr(结果有缓存)。字母序列对不上的句子标 ✗,退出码 1:修改那句(见 pronunciation.md 的"字母"一节)后重跑这两条命令。报告里的汉字也要扫一遍,发现明显读错的字(不是同音字,也不是 ASR 把"三"写成"3"这种)就按第 7 步处理。build/asr_report.txt - 真实时长与预览不同,重新看一遍 sheet。
- 通过标准: 打印 ;
mix + srt written显示--asr(没有 GLM key 时显示字母读错的句子: 0:交付时告诉用户字母读音没有机器核对,列出含点名的句子请用户重点听);截图检查通过。ASR SKIPPED
bash
cd PROJ && PY build_audio.py && PY build_audio.py --asr && node render.mjs stills auto && PY SKILL/scripts/contact_sheet.py .- TTS output is cached in , so only modified lines are synthesized again.
build/tts/ - uses Zhipu speech recognition to transcribe each narration line back into text and writes the results to
--asr; results are cached. A sentence whose letter sequence does not match is marked with ✗ and produces exit code 1. Modify that sentence according to the “letters” section of pronunciation.md, then rerun these two commands. Also review the Chinese characters in the report. If an obviously mispronounced character is found, and it is not merely a homophone or an ASR result such as converting 三 to 3, correct it according to Step 7.build/asr_report.txt - The real duration may differ from the preview. Review the contact sheet again.
- Acceptance criteria: The command prints ;
mix + srt writtenreports--asr. Without a GLM key, it displays字母读错的句子: 0; in that case, tell the user during delivery that the letter pronunciation was not machine-verified and list the sentences containing names or other potentially ambiguous terms so the user can listen to them carefully.ASR SKIPPED
第 11 步:渲染视频并交付
Step 11: Render and Deliver the Video
bash
cd PROJ && node render.mjs video 6 # 6 = 并行浏览器页数(不是帧率!帧率固定 30)- 输出 和
WS/<output_name>.mp4(WS = 用户的当前目录)。2~3 分钟的视频约需几分钟。WS/<output_name>.srt - 交付时告诉用户:mp4/srt 路径、时长、各幕内容;说明你无法听音频,请用户试听读音,特别列出你标注过读音的字。用户反馈读错时:加到 或行内标注 → 再跑第 10、11 步(只会重合成改过的句子)。
pron.json
bash
cd PROJ && node render.mjs video 6 # 6 = 并行浏览器页数(不是帧率!帧率固定 30)- This outputs and
WS/<output_name>.mp4, whereWS/<output_name>.srtis the user's current directory. A two- to three-minute video generally takes a few minutes to render.WS - During delivery, provide the MP4 and SRT paths, the duration, and a summary of every scene. Explain that you cannot listen to the audio and ask the user to audition the pronunciation. In particular, list every character whose pronunciation was manually annotated. If the user reports a mispronunciation, add it to or use an inline annotation, then rerun Steps 10 and 11. Only the modified lines will be synthesized again.
pron.json
常见错误(真实发生过)
Common Mistakes That Have Actually Occurred
| 错误做法 | 正确做法 |
|---|---|
当前目录没有 | WS 永远是用户当前目录;缺依赖由 new_video.sh 链接,缺 key 请用户配置 |
| 从别的视频文件夹(化学 chem 等)复制代码 | 用 |
编造 | 模型只有 |
| 参数是并行数;预览版面用 |
| 标注只作用于紧挨着的前一个字: |
tts 里写 | |
| 题目截图随便放在 (50,50) 400×400 | 用 |
用绝对秒数定时 | |
| 渲染完不看画面就交付 | 每次都看 |
tts 里手动写 | 不用管:pron.py 自动把相邻字母拆成 |
| 修到 0;否则会花钱合成出错误读音 |
为了"保险"把常见词都加进 | 只标会读错的字;替换成同音字会破坏断句( |
| 一个分句二十多个字不加标点 | 在换气处加逗号,分句 ≤ 18 字( |
题目图片里 | 审查时放大看文字;make_problem_png.py 已自动换字体 |
用编辑工具改 JSON 后出现弯引号 | JSON 语法引号必须是英文 |
| 图一次画好,之后每句只多一条线/一个标签,解释全在板子上 | 每句都有"指→动→留";相等就滑过去重合,立体↔俯视用 |
| 需要俯视图时在旁边另画一张图 | 同一个 3D 模型 |
| 一句旁白塞三四个知识点 | 一句一个点,画面同步出现一个元素 |
| Incorrect approach | Correct approach |
|---|---|
Create the project in another directory that already has | WS is always the user's current directory. Use |
| Copy code from another video folder, such as a chemistry project | Create the project from this skill's |
Invent settings such as | The only model is |
Assume | The argument is the number of parallel processes. Use |
Write | An annotation applies only to the immediately preceding character: |
Write expressions such as | Write |
| Place an arbitrary problem screenshot at (50,50) with a size of 400×400 | Use |
Schedule animation with an absolute timestamp such as | Use |
| Deliver the video without inspecting the rendered images | Inspect |
Manually write | This is unnecessary: pron.py automatically splits adjacent letters into |
Invoke TTS while | Resolve it to zero; otherwise, the system may spend money synthesizing incorrect pronunciation |
Add common words to | Annotate only characters that may be mispronounced. Replacing words with homophones damages phrasing, such as |
| Put more than about 20 characters in a clause without punctuation | Add commas at natural breathing points and keep clauses at 18 characters or fewer. |
Fail to notice that | Zoom in on the text during review. make_problem_png.py automatically switches fonts |
Introduce curly quotation marks such as | JSON syntax requires straight English quotation marks ( |
| Draw everything at once and then add only one line or label per narration line, leaving all reasoning on the board | Every line must contain point → move → retain. Slide equal elements until they overlap, use |
| Draw a separate top-view diagram beside the original when a top view is needed | Rotate the same 3D model with |
| Put three or four knowledge points into one narration line | Use one point per line and introduce one element in sync with the visuals |
参考文件
Reference Files
- reference/glm-tts-setup.md:智谱 GLM-TTS 注册、API Key、、音色、语速、报错处理。引导用户配置时读这个。
.env - reference/script-writing.md:格式、幕的设计、数学式子的口语写法对照表。
script.json - reference/pronunciation.md:读音控制原理、标注语法、、数学常见多音字。
pron.json - reference/visual-design.md:讲解动画怎么设计:指→动→留→连、推理→动画动作表、立体转俯视、圆锥展开、分镜格式。写分镜前必读。
- reference/animation.md:engine.js API、场景写法、版面坐标、几何/函数/立体/行程题画法、审查清单。
- reference/troubleshooting.md:报错与处理。
- reference/glm-tts-setup.md: Zhipu GLM-TTS registration, API key, , voices, speaking rate, and error handling. Read this when guiding the user through configuration.
.env - reference/script-writing.md: format, scene design, and a comparison table for converting mathematical notation into spoken language.
script.json - reference/pronunciation.md: pronunciation-control principles, annotation syntax, , and common mathematical polyphonic characters.
pron.json - reference/visual-design.md: How to design instructional animation, including point → move → retain → connect, a table mapping reasoning to animation actions, solid-to-top-view transitions, cone unfolding, and the storyboard format. This file is required before creating a storyboard.
- reference/animation.md: engine.js API, scene implementation, layout coordinates, drawing methods for geometry, functions, solid geometry, and motion/distance problems, and the review checklist.
- reference/troubleshooting.md: errors and solutions.