How samuraigpt/text-to-video-ai works
Purpose and entry point
Text-To-Video-AI is a CLI-driven Python pipeline that turns a topic into a rendered MP4 for short-form or landscape video. The operational entry point is app.py; runtime configuration and provider selection are centralized in .env.example and utility/config.py.
Pipeline orchestration
utility/pipeline_manager.py coordinates the end-to-end job: generate a script, produce narration, derive caption timing, acquire/generate visual segments, then render the output. app.py supplies the topic and invokes this orchestration. Intermediate media and final composition are local filesystem artifacts, ending in rendered_video.mp4.
Script and visual planning
LLM-backed script creation is implemented in utility/script/script_generator.py, with provider credentials/configuration supplied through utility/config.py. Visual-query generation is separated in utility/video/video_search_query_generator.py, creating a boundary between narrative content and footage retrieval/generation.
Audio and caption timeline
Narration is generated through a selectable TTS abstraction in utility/audio/audio_generator.py, backed by EdgeTTS or ElevenLabs implementations in utility/tts/edgetts_tts.py and utility/tts/elevenlabs_tts.py. The resulting audio is transcribed into timed captions by utility/captions/timed_captions_generator.py, selecting local Whisper (utility/stt/whisper_stt.py) or Deepgram (utility/stt/deepgram_stt.py). This audio-derived timeline governs caption synchronization.
Visual media sources
Background footage is managed by utility/video/background_video_generator.py. The system can use Pexels for stock B-roll and MuAPI for text-to-video generation; MuAPI API interaction is isolated in utility/muapi_client.py. External model selection—including Veo, Sora, Kling, and others exposed by MuAPI—is configuration-driven rather than embedded in the renderer.
Rendering boundary
Python rendering integration lives in utility/render/render_engine.py and utility/render/remotion_renderer.py. FFmpeg and ImageMagick are material local dependencies for media processing. A separate Node/TypeScript Remotion project (remotion-composer/package.json) provides the composition runtime, preserving a clear boundary between Python’s AI/media pipeline and React-based video layout/rendering.
Remotion composition layer
remotion-composer/src/Root.tsx registers compositions, while remotion-composer/src/CinematicRenderer.tsx is the cinematic scene renderer. Reusable visual primitives—captions, title cards, charts, screenshot/terminal scenes, callouts, and overlays—reside under remotion-composer/src/components/. Composition-specific modules such as remotion-composer/src/TitledVideo.tsx, remotion-composer/src/Explainer.tsx, and remotion-composer/src/TalkingHead.tsx support multiple output formats driven by props.
Runtime and service dependencies
The main runtime is Python 3.8+ with a Node/Remotion rendering subprocess. Required or selectable external services are LLM providers (OpenAI, Groq, Gemini), Pexels, MuAPI, ElevenLabs, and Deepgram. Local alternatives—EdgeTTS and Whisper—reduce paid-service requirements but still require local media tooling and model/runtime support.
Main entry points: pipeline_manager.py Pipeline manager · audio_generator.py Audio generator · script_generator.py Script generator · timed_captions_generator.py Timed captions generator
Components 22
Python pipeline
CLI orchestration and AI/media preparation.
- CLI entry point · Accepts a topic and starts a video job.
app.py - Runtime config · Centralizes credentials and provider selection.
utility/config.py - Pipeline manager · Coordinates script, audio, visuals, captions, and rendering.
utility/pipeline_manager.py - Script generator
utility/script/script_generator.py - Visual query generator · Separates visual retrieval prompts from narrative generation.
utility/video/video_search_query_generator.py - Audio generator · Selects the configured narration provider.
utility/audio/audio_generator.py - EdgeTTS adapter
utility/tts/edgetts_tts.py - ElevenLabs adapter
utility/tts/elevenlabs_tts.py - Timed captions generator · Transcribes narration into synchronized captions.
utility/captions/timed_captions_generator.py - Whisper adapter
utility/stt/whisper_stt.py - Deepgram adapter
utility/stt/deepgram_stt.py - Background video generator · Acquires stock footage or generated video segments.
utility/video/background_video_generator.py - MuAPI client · Isolates text-to-video API interaction.
utility/muapi_client.py - Render engine
utility/render/render_engine.py - Remotion renderer · Invokes the Node/Remotion composition runtime.
utility/render/remotion_renderer.py
Remotion composer
Node/TypeScript video composition runtime.
- Composition registry
remotion-composer/src/Root.tsx - Cinematic renderer · Builds cinematic scenes from prepared media and timeline props.
remotion-composer/src/CinematicRenderer.tsx - Visual primitives · Captions, title cards, charts, callouts, overlays, and scene elements.
- Remotion runtime
remotion-composer/package.json
Providers & local tools
Selectable services and required media tooling.
- Cloud providers · LLM, Pexels, MuAPI, ElevenLabs, and Deepgram services.
- Media tooling · FFmpeg and ImageMagick process local media.
Other components
- Rendered MP4 · Final local video composition.
Connections 26
- CLI entry point → Pipeline manager: topic
- Runtime config → Pipeline manager: settings
- Pipeline manager → Script generator: generate narrative
- Script generator → Visual query generator: script
- Pipeline manager → Audio generator: script
- Runtime config → Script generator: LLM selection
- Script generator → Cloud providers: LLM request
- Audio generator → EdgeTTS adapter: local option
- Audio generator → ElevenLabs adapter: cloud option
- ElevenLabs adapter → Cloud providers: narration API
- Audio generator → Timed captions generator: narration audio
- Timed captions generator → Whisper adapter: local option
- Timed captions generator → Deepgram adapter: cloud option
- Deepgram adapter → Cloud providers: transcription API
- Visual query generator → Background video generator: visual prompts
- Background video generator → MuAPI client: generated-video option
- Background video generator → Cloud providers: Pexels stock footage
- MuAPI client → Cloud providers: MuAPI models
- Pipeline manager → Render engine: script, media, captions
- Render engine → Remotion renderer: render job
- Remotion renderer → Remotion runtime: Node subprocess
- Remotion runtime → Composition registry: loads compositions
- Composition registry → Cinematic renderer: registers
- Cinematic renderer → Visual primitives: uses
- Remotion renderer → Rendered MP4: writes MP4
- Render engine → Media tooling: media processing