wjs-teaching-english
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTeach an English word as a video supercut
将英文单词制作成视频超级剪辑课程
Turn one English word into a self-contained HLS lesson:
intro.ts (word /IPA/ · 中文 gloss · usage + Volcano TTS)
⋯ EXT-X-DISCONTINUITY
[supercut] every season2 clip where the word is spoken (search-app /api/playlist, COS URLs)
⋯ EXT-X-DISCONTINUITY
cta.ts (关注王建硕 + Volcano TTS)
= search-app/out/<word>.m3u8No MP4 is burned — only the two cards are rendered as tiny , re-encoded to
match the supercut's codec so they play in any HLS player.
.ts将单个英文单词转换为独立的HLS课程:
intro.ts (word /IPA/ · 中文 gloss · usage + Volcano TTS)
⋯ EXT-X-DISCONTINUITY
[supercut] every season2 clip where the word is spoken (search-app /api/playlist, COS URLs)
⋯ EXT-X-DISCONTINUITY
cta.ts (关注王建硕 + Volcano TTS)
= search-app/out/<word>.m3u8无需生成MP4文件——仅将两张卡片渲染为小型文件,并重新编码以匹配超级剪辑的编码格式,确保可在任何HLS播放器中播放。
.tsPrerequisites (check once)
前置条件(只需检查一次)
- /
ffmpegon PATH (Homebrew).ffprobe - Python SDK (declared in mira
volcengine, used for TTS):requirements.txt. If missing, ask the user to allowpython3 -c "import volcengine"(it's a pinned repo dependency).pip3 install volcengine==1.0.58 - The deployed search-app at (default). Override with
https://search-app-three-kappa.vercel.appif running locally (needs Node ≥ 23.6 +SEARCH_APP_BASE=http://localhost:3000).npm start
- 系统PATH中需配置/
ffmpeg(可通过Homebrew安装)。ffprobe - Python SDK(已在mira的
volcengine中声明,用于语音合成):执行requirements.txt验证是否安装。若未安装,请用户允许执行python3 -c "import volcengine"(这是固定版本的仓库依赖)。pip3 install volcengine==1.0.58 - 已部署的search-app服务,默认地址为。若本地运行,可通过设置
https://search-app-three-kappa.vercel.app覆盖默认地址(需Node版本≥23.6,并执行SEARCH_APP_BASE=http://localhost:3000启动服务)。npm start
Steps
操作步骤
-
Get the word. A single English word (or short phrase). If the user gave a sentence, pick the target word.
-
Write the mini-lesson JSON. YOU (Claude) author it — no dictionary API. Keep it accurate and concise. Save to a temp file, e.g.:
/tmp/lesson.jsonjson{ "word": "love", "ipa": "/lʌv/", "pos": "v. / n.", "gloss": "爱,热爱", "usage": "下面是它在真实电影里的说法", "tts_text": "love. 爱。" }- is read aloud over the intro card — keep it to the word + a short 中文 gloss (Volcano reads mixed English/中文 fine).
tts_text - is one short line shown on the card (≤ ~20 chars renders best at low resolutions).
usage
-
Build it:bash
cd /Users/jianshuo/code/mira/search-app python3 scripts/build_lesson.py --word love --lesson /tmp/lesson.jsonUseful flags:(default),--speaker zh_female_qingxin(max clips),--limit 300(silent cards),--no-tts,--base <url>.--out <dir> -
Report the printed output path () and the clip count. The
search-app/out/<word>.m3u8plus its sibling.m3u8/<word>.intro.tsare the deliverable;<word>.cta.tsis git-ignored.out/
-
获取目标单词:单个英文单词(或短语)。若用户提供的是句子,需提取其中的目标单词。
-
编写迷你课程JSON文件:由你(Claude)创作内容——无需调用词典API。内容需准确简洁,保存至临时文件,例如:
/tmp/lesson.jsonjson{ "word": "love", "ipa": "/lʌv/", "pos": "v. / n.", "gloss": "爱,热爱", "usage": "下面是它在真实电影里的说法", "tts_text": "love. 爱。" }- 是介绍卡片的语音旁白内容——只需包含单词+简短中文释义(Volcano支持中英文混合语音合成)。
tts_text - 是显示在卡片上的一行简短说明(≤约20个字符时,在低分辨率下显示效果最佳)。
usage
-
生成课程视频:bash
cd /Users/jianshuo/code/mira/search-app python3 scripts/build_lesson.py --word love --lesson /tmp/lesson.json常用参数:(默认发音人)、--speaker zh_female_qingxin(最大片段数量)、--limit 300(无语音卡片)、--no-tts(指定search-app地址)、--base <url>(指定输出目录)。--out <dir> -
反馈结果:告知用户打印出的输出路径()以及片段数量。交付物包括
search-app/out/<word>.m3u8文件及其配套的.m3u8和<word>.intro.ts文件;<word>.cta.ts目录已被git忽略。out/
Notes
注意事项
- If the word has no clips, the script exits with "no clips match" and writes nothing — tell the user and suggest a more common word.
- Intro/CTA are encoded to the FIRST supercut segment's resolution/codec/fps so
the first discontinuity needs no decoder re-init (avoids ).
bufferAppendError - To play locally: , or serve the
ffplay search-app/out/<word>.m3u8folder over HTTP and open in any HLS player (Safari playsout/natively)..m3u8
- 若该单词无匹配片段,脚本会提示“no clips match”并终止运行,不会生成任何文件——需告知用户并建议使用更常用的单词。
- 介绍/CTA卡片会按照超级剪辑的第一个片段的分辨率、编码格式和帧率进行编码,因此第一次格式切换无需重新初始化解码器(避免错误)。
bufferAppendError - 本地播放方式:执行,或通过HTTP服务托管
ffplay search-app/out/<word>.m3u8目录后,在任意HLS播放器中打开(Safari原生支持播放.m3u8文件)。out/