How to Customize Videos Generated by MoneyPrinterTurbo: A Complete Technical Guide
You can customize MoneyPrinterTurbo videos by modifying the VideoParams data model either through the Streamlit UI in webui/Main.py or programmatically via the FastAPI endpoints, controlling everything from video sources and transitions to subtitle styling and audio mixing.
MoneyPrinterTurbo is an open-source automated video generation tool that creates content from text prompts. To customize videos generated by MoneyPrinterTurbo, you need to understand how the VideoParams schema flows from the user interface through to the rendering pipeline in app/services/video.py.
Understanding the VideoParams Data Model
The foundation of all customization lies in the VideoParams Pydantic model defined in app/models/schema.py (lines 71-99). This schema enumerates every configurable field used by the generator.
Core Configuration Fields
- Video source (
video_source) – Choose from Pexels, Pixabay, local files, TikTok, Bilibili, or Xiaohongshu. - Concat mode (
video_concat_mode) – random or sequential ordering of clips. - Transition mode (
video_transition_mode) – Options include none, shuffle, fade-in/out, or slide-in/out. - Aspect ratio (
video_aspect) – Portrait (9:16) or landscape (16:9). - Clip duration (
video_clip_duration) – Length of each sub-clip in seconds.
Audio and Subtitle Settings
- Audio – Configure voice name/volume, background music type/file/volume.
- Subtitles – Enable flag, font selection, size, color, position (top/center/bottom/custom), and custom Y-offset (
custom_position).
Customizing Through the Streamlit UI
The Streamlit interface in webui/Main.py provides visual controls that map directly to VideoParams fields.
Video Source and Concatenation Settings
The video source selector (lines 58-66) allows you to choose between stock footage providers or local uploads. The concat mode selector (lines 88-100) toggles between random and sequential clip ordering.
# From webui/Main.py - how parameters are collected
video_source = st.selectbox("Video Source", ["Pexels", "Pixabay", "Local", ...])
video_concat_mode = st.radio("Concat Mode", ["random", "sequential"])
Visual Effects and Aspect Ratio
The transition mode selector (lines 604-610) controls clip transitions, while the aspect ratio selector (lines 21-26) sets the output dimensions.
Subtitle Styling Options
The subtitle configuration panel (lines 871-904) exposes all text rendering options:
- Position: Radio buttons for top/center/bottom/custom
- Custom Y-offset: Number input for percentage from top (when custom position selected)
- Typography: Font picker, size slider, color pickers for text and stroke
Programmatic Customization via API
For automated workflows, you can bypass the UI and call the FastAPI endpoint directly. The endpoint in app/controllers/v1/llm.py (lines 23-38) accepts a VideoParams JSON payload.
import requests
payload = {
"video_subject": "Spring flowers",
"video_aspect": "9:16",
"video_concat_mode": "random",
"video_transition_mode": "fade_in",
"video_clip_duration": 5,
"video_count": 2,
"subtitle_enabled": True,
"subtitle_position": "custom",
"custom_position": 30.0,
"font_name": "STHeitiMedium.ttc",
"font_size": 70,
"text_fore_color": "#FFEE00",
"stroke_color": "#000000",
"stroke_width": 2.0,
"voice_name": "zh-CN-XiaoxiaoNeural-Female",
"voice_volume": 1.2,
"bgm_type": "random",
"bgm_volume": 0.3,
}
response = requests.post(
"http://localhost:8000/api/v1/video/generate",
json=payload,
)
print(response.json()) # Returns downloadable video URL
Deep Dive into the Rendering Pipeline
Understanding the service layer in app/services/video.py helps you predict how your customizations affect the final output.
Video Processing in video.py
The combine_videos function (lines 49-108) handles sub-clip creation. It cuts materials into segments of max_clip_duration, shuffles them if concat mode is random, and repeats until matching the audio length.
# Logic flow in app/services/video.py
def combine_videos(...):
# Lines 49-66: Sub-clip slicing and shuffling
# Lines 74-84: Aspect ratio scaling and padding
# Lines 96-107: Transition effect application
Transition Effects Implementation
Transition handling (lines 96-107) dispatches to helper functions in app/services/utils/video_effects.py (lines 4-22). These wrap MoviePy effects:
- fadein_transition: Gradual opacity increase
- fadeout_transition: Gradual opacity decrease
- slidein_transition: Horizontal entry movement
- slideout_transition: Horizontal exit movement
Subtitle Positioning Logic
For custom subtitle positioning, the code in app/services/video.py (lines 20-34) calculates Y-coordinates based on the custom_position percentage from the top of the frame, clamping values to ensure text remains visible.
Audio Mixing and Final Rendering
The pipeline mixes TTS voice tracks with background music (lines 60-70), applying volume multipliers and fade-outs. Final merging (lines 44-58) writes the output incrementally to manage memory usage, respecting the codec and thread count settings.
Summary
- Data Model: All customization flows through
VideoParamsinapp/models/schema.py, defining video sources, transitions, aspect ratios, and subtitle styling. - UI Customization: The Streamlit interface in
webui/Main.pyexposes these parameters through intuitive controls for video concatenation, transitions, and typography. - API Access: Programmatic control is available via FastAPI endpoints in
app/controllers/v1/llm.py, accepting JSON payloads that mirror the UI settings. - Rendering Pipeline: The service layer in
app/services/video.pyprocesses these parameters throughcombine_videosandgenerate_video, applying transitions fromapp/services/utils/video_effects.pyand handling custom subtitle positioning.
Frequently Asked Questions
How do I change the video aspect ratio in MoneyPrinterTurbo?
You can set the aspect ratio via the video_aspect parameter in VideoParams. In the Streamlit UI (webui/Main.py, lines 21-26), select either "Portrait" (9:16) or "Landscape" (16:9). Programmatically, pass "video_aspect": "9:16" or "16:9" in your API payload. The rendering pipeline in app/services/video.py (lines 74-84) automatically rescales and pads clips to match your selected dimensions.
Can I use my own background music instead of random selection?
Yes. Set bgm_type to "custom" and provide the file path in bgm_file. In the UI, select "Custom" from the background music dropdown and upload your MP3 file. In the API payload, include "bgm_type": "custom" and "bgm_file": "/path/to/music.mp3". The audio mixing logic in app/services/video.py (lines 60-70) loads your custom track, applies the bgm_volume multiplier, and mixes it with the TTS voice audio.
How do I position subtitles at a custom height in the video?
Enable subtitles by setting subtitle_enabled to true, then set subtitle_position to "custom" and specify the vertical position using custom_position (a percentage from the top of the frame). In the UI, check "Enable Subtitles", select "Custom" for position, and enter a value like 30 for 30% from the top. In the API, use "subtitle_position": "custom" and "custom_position": 30.0. The positioning logic in app/services/video.py (lines 20-34) calculates the pixel coordinate from this percentage and clamps it to ensure the text remains within the video frame.
What video sources are supported besides Pexels and Pixabay?
MoneyPrinterTurbo supports multiple video sources defined in the video_source field of VideoParams. According to the schema in app/models/schema.py and the UI selector in webui/Main.py (lines 58-66), you can choose from Pexels, Pixabay, local files, TikTok, Bilibili, and Xiaohongshu. When using local files, upload MP4 videos or PNG images through the UI, or provide file paths when calling the API directly. The combine_videos function in app/services/video.py processes materials from any of these sources identically once they are downloaded or loaded into the temporary workspace.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →