A 12m 51s narrated teaching video (1920×1080, H.264/AAC, English captions embedded) on the counsels God gave the Prophet Muhammad on the night of the Mi'raj (Hadith al-Mi'raj). It teaches the text using Justin Sung's method: big picture first, then chunking, then how the chunks relate, then a self-test.
- Source page: https://hekm.co/article/1338 (cites Bihar al-Anwar)
- Made in Amp thread: https://ampcode.com/threads/T-01a104c3-3956-740b-a0c6-55406b851e96
Files
| Path | What it is |
|---|---|
miraj-counsels-lesson.mp4 |
Final video, with the captions embedded as a soft subtitle track |
miraj-counsels-lesson.srt |
The same captions as a separate file |
miraj-counsels-map.png |
The concept map from the lesson: all six buckets on one page |
slides-contact-sheet.png |
Thumbnails of all 35 slides |
../../transcripts/miraj-counsels-lesson.txt |
Full narration script |
build/ |
Scripts that rebuild the video from scratch |
Lesson structure
- Layer 1, the big picture: the text is a dialogue. Its first answer is the thesis: the best deed is reliance on God (tawakkul) and contentment (riḍā).
- Layer 2, six buckets: Goal, Obstacle (the nafs and love of the world), Practices (hunger, silence, lawful living), Guardrail (wara'), Fruits, and Mirror.
- Layer 3, how the buckets connect: the Practices weaken the Obstacle. Wara' protects the Practices. The Practices produce the Fruits: wisdom, then knowing God, then certainty. Certainty leads to not minding ease or hardship, which is riḍā. So the chain ends where the text began.
- Self-test: sort the text's "seven traits of a worshipper" into the buckets.
Rebuild
Needs Python 3, ffmpeg, Chrome/Chromium, and network access for the TTS voice.
cd build
./fetch-fonts.sh # Amiri, Caveat, Inter (all OFL)
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
CHROME=/path/to/chrome .venv/bin/python build.py # slides (PNG) + narration (MP3/SRT) per frame
.venv/bin/python assemble.py # segments, captions, loudnorm, final mux
# Output: build/.work/lesson.mp4 and build/.work/lesson.srt
scenes.pyholds the lesson. Each frame is HTML plus its narration. To change the content, edit this file.build.pyrenders each frame with headless Chrome and voices it with Microsoft Edge TTS (en-US-AndrewNeural, rate −4%).assemble.pyholds each slide for the length of its narration, plus 0.35 s before and 0.65 s after. New scenes fade in. It then joins the segments, shifts the caption timings to match, and normalizes loudness to −16 LUFS.PNG_ONLY=1 python build.py [frame numbers]re-renders slides without calling TTS. Use it to check the layout.- TTS output can differ slightly between runs, so a rebuilt video is close to the committed one but not byte-identical.
- Edge TTS is an unofficial endpoint. When these scripts were committed (Oct 14, 2026), it rejected new requests with HTTP 403. If it still fails, swap in another TTS voice inside
tts()inbuild.py. The rest of the pipeline does not depend on which TTS you use. With the original narration audio,assemble.pyreproduces the committed captions byte for byte and the same 770.9 s length.
Notes and known limits
- The English quotations are my own translations of the Arabic. Have someone who knows the text check them before sharing.
- The TTS voice pronounces Arabic terms the English way. I tested a few spellings and kept the closest ones, for example "reeda" for riḍā and "Yaa Ahmed". Mi'raj still sounds like "mirage", so the narration mostly says "the ascension" instead. Fixing this properly needs human narration or recorded Arabic clips.
- The voice is a generic AI voice. It copies Justin Sung's teaching method, not his voice.
- Checks run on the final file: 770.9 s long, no audio clipping (peak −1.4 dB after loudnorm), and sample frames inspected by eye. The narration was checked by automated transcription only, not by a person listening.