https://www.youtube.com/@PaperExplainAgent
AI pipeline that ingests PDFs (or topics), plans multi‑scene stories, generates Manim animations with TTS, and combines them into narrated videos.
- PDF → markdown + figures, builds a scene outline, generates per‑scene code, renders with manim + Kokoro voiceover, and stitches the scenes into a single MP4/SRT.
- Supports partial reruns: skips scenes with
succ_rendered.txt, re‑renders missing scenes, and can combine only. - Fast combine: optional stream‑copy ffmpeg concat (
--fast_combine) to avoid full re‑encode when streams match. - Utilities: status checks, peek of existing renders, context-learning/RAG support, and concurrent scene/topic processing.
conda create -n tea python=3.12.8
conda activate tea
pip install -r requirements.txtInstall manim dependencies (LaTeX, etc.) per https://docs.manim.community. Install SoX (for voiceover); on Windows ensure sox.exe is on PATH.
Download Kokoro TTS:
mkdir -p models
wget -P models https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx
wget -P models https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.binCreate .env (see .env.template) with your model keys (OpenAI/Azure/Gemini/Vertex/Anthropic) and Kokoro paths.
From repo root:
# PowerShell
set "PYTHONPATH=%CD%;%PYTHONPATH%"
# or bash
export PYTHONPATH=$(pwd):$PYTHONPATHSingle topic:
python generate_video.py \
--model "gemini/gemini-3-pro-preview" \
--helper_model "gemini/gemini-3-pro-preview" \
--output_dir "output/exp1" \
--topic "Big O notation" \
--context "worst-case complexity explanation"From a PDF:
python generate_video.py \
--model "gemini/gemini-3-pro-preview" \
--helper_model "gemini/gemini-3-pro-preview" \
--output_dir "output/exp1" \
--pdf_path "data/papers/nested_learning.pdf"Combine only (reuse existing renders):
python generate_video.py \
--pdf_path "data/papers/nested_learning.pdf" \
--output_dir "output/exp1" \
--model "gemini/gemini-3-pro-preview" \
--helper_model "gemini/gemini-3-pro-preview" \
--only_combine \
--fast_combine # optional stream-copy concatRender missing scenes only (skip combine):
python generate_video.py ... --only_renderPlan only (no render/combine):
python generate_video.py ... --only_plan--only_plangenerate outline + plans, stop.--only_renderrender missing scenes, no combine.--only_combinestitch existing scenes.--fast_combinetry stream-copy concat (skip re-encode).--peek_existing_videossummarize combined/scene renders in output_dir.--check_statusstatus table for batch theorems.--scenes 1 3limit to specific scenes (with theorems_path).- Concurrency:
--max_scene_concurrency,--max_topic_concurrency.
When --fast_combine is set, combine_videos first tries ffmpeg -f concat -safe 0 -i <list> -c copy with absolute paths. If streams mismatch or concat fails, it falls back to the re-encode path (libx264+aac) and then merges subtitles.
Allowed model strings live in src/utils/allowed_models.json (litellm format). Includes Gemini, Vertex, OpenAI (openai/gpt-5.6-sol, openai/gpt-5.6-terra, openai/o4-mini, gpt-4o), Anthropic (anthropic/claude-opus-4-8, plus Bedrock Claude), and DeepSeek.
ModuleNotFoundError: src: ensure PYTHONPATH includes repo root (see step 3).- SoX not found: add its
bin(e.g.,C:\ProgramData\chocolatey\lib-bad\sox.portable\14.4.1\lib) to PATH, reopen shell,sox --version. - Missing LaTeX/manim deps: install TeX + manim prerequisites for your OS.
- Combining hangs: use
--fast_combine; if it falls back, allow re-encode to finish or re-run--only_combine --fast_combineonce scenes exist.
Requires video (mp4) + subtitles (srt). Example:
python evaluate.py --file_path path/to/topic_folder --output_folder eval_out --model_text gpt-4o --eval_type allIf you use this code/data:
@misc{ku2025theoremexplainagentmultimodalexplanationsllm,
title = {TheoremExplainAgent: Towards Multimodal Explanations for LLM Theorem Understanding},
author = {Max Ku and Thomas Chong and Jonathan Leung and Krish Shah and Alvin Yu and Wenhu Chen},
year = {2025},
eprint = {2502.19400},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
url = {https://arxiv.org/abs/2502.19400}
}
MIT. See LICENSE.