Pipeline that converts the Wenyan Book (《文言陰符》) into narrated video chapters with generated audio, transcripts, translations, and Remotion compositions.
| Path | Purpose |
|---|---|
book/ |
Git submodule tracking wenyan-lang/book; keep it synced instead of editing files directly. |
processor/ |
Python (uv-managed) tools that parse chapters, segment sentences, translate, transcribe, and synthesize audio. |
renderer/ |
Remotion project plus scripts that turn processor output into React components and videos. |
renderer/public/** |
Generated JSON, transcripts, and audio assets that the renderer consumes. |
renderer/src/generated/ |
Segment metadata emitted by bun run scripts/generate-segments.ts. |
transcription-utils/ |
Helpers shared by multiple processor scripts. |
uploader/ |
Python tools to upload generated videos to YouTube with metadata and thumbnails. |
Large media trees such as renderer/public/audios/, renderer/public/transcripts/build/, and renderer/src/generated/segments-*.ts are reproducible—regenerate them via the pipeline instead of editing by hand.
flowchart LR
subgraph Source
BMD[book/*.md\nWenyan Book text]
end
subgraph Processor
PM[parse-markdown.py → renderer/public/chapters]
BS[build-sentences.py → renderer/public/sentences]
SG[segment-text.py → renderer/public/segments]
TR[translate.py → renderer/public/translations]
TS[transcribe.py → renderer/public/transcripts]
BS2[build-segmented-transcripts.py → renderer/public/transcripts/build]
SY[synthesize.py → renderer/public/audios]
VC[voice-change.py → renderer/public/audios/female]
TT[transcribe-titles.py → renderer/public/transcripts/audio-n.txt]
TA[synthesize-titles.py → renderer/public/audios/audio-n.mp3]
subgraph Utils
FG[fill-segment-gaps.py]
RS[reconstruct_segment_transcripts.py]
end
end
subgraph Renderer
GS[bun run scripts/generate-segments.ts → renderer/src/generated/segments-*.ts]
RV[bun run remotion render → final videos]
end
subgraph Uploader
UP[python uploader/upload.py → YouTube]
end
BMD --> PM --> BS --> SG --> TR --> TS --> BS2 --> SY --> VC --> GS --> RV --> UP
PM --> TT --> TA --> GS
TS -.-> RS -.-> BS2
SG -.-> FG -.-> SG
Consult processor/README.md for script-by-script details.
git clone <repo-url>
cd wenyan-book-video
git submodule update --init --recursive
bun install- Always use
bun(bun install,bun run …) for JavaScript/TypeScript workspaces. - Python tooling inside
processor/anduploader/is managed by uv. Run scripts withuv run …so imports resolve against the package.
Nix Flake shell (recommended)
nix develop # or allow direnv and just `cd` into the repoThe flake provides Python 3.13, uv, Bun, Node 20, ffmpeg, sox, espeak-ng, git, and other CLI dependencies. Python packages are synced automatically via uv sync when entering the shell.
Manual setup
- Install Bun and run
bun installat the repo root. - Install uv (
pip install uvor via package manager) and runuv syncinsideprocessor/anduploader/. - Ensure system packages
ffmpeg,sox, andespeak-ngare available for the audio pipeline.
-
Prepare chapter data
- Run processor scripts in order (
parse-markdown.py,build-sentences.py,segment-text.py,translate.py,transcribe.py,build-segmented-transcripts.py). Useuv runfor each, e.g.cd processor && uv run python segment-text.py. Use-c <chapter>forbuild-segmented-transcripts.pyto limit scope. - Titles follow
transcribe-titles.py→synthesize-titles.py. - Helper scripts:
fill-segment-gaps.pyto fill missing segments,reconstruct_segment_transcripts.pyto rebuild transcripts from segments.
- Run processor scripts in order (
-
Synthesize audio
uv run python synthesize.pyproduces raw TTS chunks underrenderer/public/audios/. Use-c <chapter>to limit to one chapter.uv run python voice-change.pytransforms them (e.g., female timbre) intorenderer/public/audios/female/.
-
Generate renderer segments
- From
renderer/, runbun run scripts/generate-segments.ts. This snapshots current processor artifacts intorenderer/src/generated/segments-*.tsconsumed by the Remotion components.
- From
-
Render videos
- Still in
renderer/, executebun run remotion render. Confirm that therenderer/src/generated/segments-*.tsfiles and audio/transcript assets exist beforehand.
- Still in
-
Upload to YouTube
- Configure
uploader/config.tomlanduploader/client_secrets.json. - Run
uv run uploader/upload.py <chapter_id>to upload the rendered video. - Supports thumbnails (
uploader/thumbnails/{id}.png) and auto-playlist addition.
- Configure
segment-text– launches marimo forprocessor/segment-text.pywith live reload.voice-change– launches marimo forprocessor/voice-change.py.main– convenience entry point defined in the dev shell for orchestrating the processor pipeline.
All three are available inside nix develop (or via direnv).
Update the Wenyan text submodule without touching its tracked files directly:
git submodule update --remote book
git add book
git commit -m "Update Wenyan book submodule"- Missing Python deps –
cd processor && uv sync(orcd uploader && uv sync) rehydrates fromuv.lock. - C library/FFmpeg issues – make sure you are inside
nix developor have the binaries installed locally. - Regenerating assets – delete problematic items under
renderer/public/audios/,renderer/public/transcripts/build/, orrenderer/src/generated/and rerun the relevant scripts instead of editing the outputs.
This project is released under the MIT License.