Environment:ALwrity ALwrity moviepy Requirements
| Knowledge Sources | |
|---|---|
| Domains | Video_Processing, Image_Generation, Media |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
Python media environment with moviepy 2.1.2, matplotlib (Agg backend), Pillow, and numpy for podcast B-roll video composition and scene concatenation.
Description
This environment layer provides the video and image composition stack for ALwrity's podcast pipeline. It uses moviepy 2.1.2 (pinned exact version) for video clip manipulation, crossfade transitions, and final episode concatenation. Chart rendering uses matplotlib with the non-interactive `Agg` backend (set explicitly via `matplotlib.use("Agg")` to avoid display errors on headless servers). Pillow handles image overlays and text rendering, while numpy supports array operations for chart data.
The `BrollComposer` creates layered video scenes (background + chart + avatar circle + text overlays), and `PodcastVideoCombinationService` concatenates scene videos into final episodes with progress callbacks.
Usage
Use this environment for:
- B-roll composition — layered video scene generation with charts and overlays
- Podcast video concatenation — combining scene videos into final episodes
- Chart generation — matplotlib-rendered bar/line/pie charts as transparent PNGs
- Crossfade transitions — dissolve effects between video scenes
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | ffmpeg must be installed system-wide |
| Hardware | 2+ CPU cores, 4GB RAM | Video encoding is CPU-intensive |
| Disk | 5GB SSD | Temporary video files and chart PNGs |
Dependencies
System Packages
- `ffmpeg` (required by `imageio-ffmpeg`; must be on `PATH` or bundled)
Python Packages
- `moviepy` == 2.1.2 (pinned exact version for API compatibility)
- `imageio` >= 2.31.0
- `imageio-ffmpeg` >= 0.4.9
- `matplotlib` >= 3.8.0
- `Pillow` >= 10.0.0
- `numpy` >= 1.24.0
Credentials
No additional credentials required. This environment uses no external API keys.
Quick Install
# System dependency
sudo apt-get install -y ffmpeg
# Python packages
pip install moviepy==2.1.2 imageio>=2.31.0 imageio-ffmpeg>=0.4.9 \
matplotlib>=3.8.0 Pillow>=10.0.0 numpy>=1.24.0
Code Evidence
Agg backend setup from `backend/services/podcast/broll_composer.py:15`:
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
moviepy 2.x import API from `backend/services/podcast/broll_composer.py:18-22`:
from moviepy import (
VideoFileClip, ImageClip, CompositeVideoClip,
concatenate_videoclips,
)
import moviepy.video.fx as vfx
Pinned version in `backend/requirements.txt:64`:
moviepy==2.1.2
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ModuleNotFoundError: No module named 'moviepy'` | moviepy not installed | `pip install moviepy==2.1.2` |
| `RuntimeError: matplotlib is currently using agg, which is a non-GUI backend` | Display not available on headless server | Ensure `matplotlib.use("Agg")` is called before `pyplot` import |
| `ImageIO ffmpeg not found` | ffmpeg binary missing | `pip install imageio-ffmpeg>=0.4.9` or install system `ffmpeg` |
| `ImportError: cannot import name 'VideoFileClip' from 'moviepy'` | moviepy 1.x vs 2.x API difference | Pin `moviepy==2.1.2` exactly; 2.x uses `from moviepy import ...` not `from moviepy.editor import ...` |
Compatibility Notes
- moviepy version: Pinned to `2.1.2` because moviepy 2.x changed the import API (`from moviepy import ...` vs 1.x `from moviepy.editor import ...`). Upgrading requires code changes.
- Headless servers: `matplotlib.use("Agg")` is mandatory before importing `pyplot` to avoid display backend errors on headless Linux.
- ffmpeg: Required at both system level and Python level (`imageio-ffmpeg`). The Python package bundles a static ffmpeg binary, but system ffmpeg is preferred for codec support.
- macOS: Works natively; `brew install ffmpeg` for system ffmpeg.