This project is a modular Python application that generates viral "brainrot" style video reels using AI-powered script generation, text-to-speech, and automated video editing.
- AI script generation using Alchemyst API
- Character voice generation using ElevenLabs API or local TTS fallback
- Automatic video creation with background and character overlays
- Modular codebase for easy extension and maintenance
- Error handling and fallback logic for reliability
##Sample Video
brainrot_reel_20250630_171003.mp4
##ARCHITECTURE
flowchart TD
subgraph Assets
A1[assets/backgrounds]
A2[assets/characters]
A3[assets/output]
end
subgraph Temp
T1[temp/]
T2[temp_audio/]
end
subgraph Config
C1[.env]
C2[config.py]
end
subgraph Core
M[main.py]
SG[script_generator.py]
VG[voice_generator.py]
VC[video_creator.py]
U[utils.py]
S[subtitles.py]
end
subgraph Tests
TST1[test.py]
TST2[testac]
end
%% Flow
M --> SG
M --> VG
M --> VC
M --> U
M --> C2
M --> C1
SG -->|Uses| C1
SG -->|Uses| C2
SG -->|Writes/Reads| T2
VG -->|Reads| SG
VG -->|Uses| C1
VG -->|Uses| C2
VG -->|Reads/Writes| T2
VC -->|Reads| VG
VC -->|Reads| A1
VC -->|Reads| A2
VC -->|Writes| A3
VC -->|Uses| C2
U -->|Utility| M
S --> VC
TST1 --> M
TST2 --> M
%% Asset/Temp relations
VC -->|Temp Files| T1
VC -->|Temp Audio| T2
%% Show outputs
A3 -->|Final Videos| OUT[User]
AI/
├── assets/
│ ├── backgrounds/
│ ├── characters/
│ └── output/
├── temp/
├── temp_audio/
├── .env
├── config.py
├── main.py
├── requirements.txt
├── script_generator.py
├── subtitles.py
├── test.py
├── testac
├── utils.py
├── video_creator.py
└── voice_generator.py
-
Clone the repository
git clone https://github.com/itsshresth/brainrot.git cd brainrot -
Install Python dependencies
pip install -r requirements.txt -
Install FFmpeg
- Windows:
choco install ffmpeg - macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpeg
- Windows:
-
Create a
.envfile in the project root with your API keys:ALCHEMYST_API_KEY=your_alchemyst_key_here ELEVENLABS_API_KEY=your_elevenlabs_key_here -
(Optional) Add background videos and character images
- Place vertical MP4 backgrounds in
assets/backgrounds/ - Place PNG character images in
assets/characters/
- Place vertical MP4 backgrounds in
Run the main application:
python main.py
Follow the prompts:
- Choose a character
- Enter your topic and context
- Wait for the video to be generated in
assets/output/
MIT License
For issues or feature requests, open an issue on GitHub.