# Rendering Reference ## Prerequisites ```bash manim --version # Manim CE pdflatex --version # LaTeX ffmpeg -version # ffmpeg ``` ## CLI Reference ```bash manim -ql script.py Scene1 Scene2 # draft (480p 15fps) manim -qm script.py Scene1 # medium (720p 30fps) manim -qh script.py Scene1 # production (1080p 60fps) manim -ql --format=png -s script.py Scene1 # preview still (last frame) manim -ql --format=gif script.py Scene1 # GIF output ``` ## Quality Presets | Flag | Resolution | FPS | Use case | |------|-----------|-----|----------| | `-ql` | 854x480 | 15 | Draft iteration (layout, timing) | | `-qm` | 1280x720 | 30 | Preview (use for text-heavy scenes) | | `-qh` | 1920x1080 | 60 | Production | **Text rendering quality:** `-ql` (480p15) produces noticeably poor text kerning and readability. For scenes with significant text, preview stills at `-qm` to catch issues invisible at 480p. Use `-ql` only for testing layout and animation timing. ## Output Structure ``` media/videos/script/480p15/Scene1_Intro.mp4 media/images/script/Scene1_Intro.png (from -s flag) ``` ## Stitching with ffmpeg ```bash cat > concat.txt << 'EOF' file 'media/videos/script/480p15/Scene1_Intro.mp4' file 'media/videos/script/480p15/Scene2_Core.mp4' EOF ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4 ``` ## Add Voiceover ```bash # Mux narration ffmpeg -y -i final.mp4 -i narration.mp3 -c:v copy -c:a aac -b:a 192k -shortest final_narrated.mp4 # Concat per-scene audio first cat > audio_concat.txt << 'EOF' file 'audio/scene1.mp3' file 'audio/scene2.mp3' EOF ffmpeg -y -f concat -safe 0 -i audio_concat.txt -c copy full_narration.mp3 ``` ## Add Background Music ```bash ffmpeg -y -i final.mp4 -i music.mp3 \ -filter_complex "[1:a]volume=0.15[bg];[0:a][bg]amix=inputs=2:duration=shortest" \ -c:v copy final_with_music.mp4 ``` ## GIF Export ```bash ffmpeg -y -i scene.mp4 \ -vf "fps=15,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ output.gif ``` ## Aspect Ratios ```bash manim -ql --resolution 1080,1920 script.py Scene # 9:16 vertical manim -ql --resolution 1080,1080 script.py Scene # 1:1 square ``` ## Render Workflow 1. Draft render all scenes at `-ql` 2. Preview stills at key moments (`-s`) 3. Fix and re-render only broken scenes 4. Stitch with ffmpeg 5. Review stitched output 6. Production render at `-qh` 7. Re-stitch + add audio