An automated pipeline to generate stunning video content for YouTube and Instagram using AI-generated scripts, images, and video transitions.
The pipeline orchestrates a multi-step process to create high-quality, engaging content:
- AI Script Generation: Generates a thematic script (JSON) including image prompts, video transition prompts, and social media metadata (titles, descriptions, tags).
- Parallel Image Generation: Uses AI models to generate 4 high-resolution images based on the script's prompts.
- Dynamic Video Transitions: Generates 3 video segments that smoothly transition between the generated images (1→2, 2→3, 3→4).
- Video Composition: Merges the segments into a single final video using
moviepy. - Automated Social Posting: Simultaneously uploads the final video to YouTube and Instagram Reels.
- Cleanup: Automatically removes intermediate files to save space.
The system generates a series of images that tell a story or show a transformation:
| Image 1 (Before) | Image 4 (After) |
|---|---|
![]() |
![]() |
The pipeline generates smooth animations between the images:
| Transition 1 (1 → 2) | Transition 2 (2 → 3) | Transition 3 (3 → 4) |
|---|---|---|
A combined, high-quality video ready for social media:
Final Location: output/final_video_20260201_174256.mp4
- Python 3.10+
- Google Cloud Project (for YouTube API)
- Instagram Business Account (for Instagram Graph API)
- Supabase account (if using for storage/logs)
-
Clone the repository:
git clone <repository-url> cd yt-veo3
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Copy the example env file and add your credentials:
cp .env.example .env
Then edit
.envwith your actual values:GOOGLE_API_KEY=your_google_api_key INSTAGRAM_TOKEN=your_instagram_graph_token INSTAGRAM_USER_ID=your_instagram_user_id SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key
-
YouTube API Credentials: For a quick start, you can copy the example file:
cp client_secrets..example.json client_secrets.json
Then fill in your
client_idandclient_secretfrom the Google Cloud Console.To set up from scratch:
- Go to the Google Cloud Console.
- Create a new project.
- Enable API: Search for "YouTube Data API v3" and click Enable.
- OAuth Consent Screen:
- Select External.
- Fill in the required app information.
- Scopes: Add
https://www.googleapis.com/auth/youtube.upload. - Test Users: Add your own Google email address (This is required while the app is in "Testing" mode).
- Credentials:
- Click Create Credentials > OAuth client ID.
- Select Application Type: Desktop app.
- Download the JSON file and rename it to
client_secrets.json.
- Place
client_secrets.jsonin the root of this project.
-
Generate
token.pkl: The first time you runmain.pyoryt.py, a browser window will open asking you to log in to your Google account.- Select the account you added as a Test User.
- Grant the requested permissions.
- Once successful, the script will automatically create a
token.pklfile. This file stores your authentication so you won't need to log in again.
Caution
Security Note: Never commit client_secrets.json, token.pkl, or .env to a public repository. They contain sensitive API keys and access tokens. These files are already included in .gitignore.
To start the full generation and upload process, simply run:
python main.pyThe script will log progress to the console and to pipeline.log.
The pipeline creates smooth transitions between images. You can find the individual segments in the generated_videos/ directory.
The final combined video is saved in the output/ directory.
- Location:
output/final_video_YYYYMMDD_HHMMSS.mp4 - Resolution: 1080x1920 (Standard Reel/Short format)
main.py: The main orchestration script.models/: Contains the AI logic for scripts, images, and video generation.yt.py: YouTube API integration for uploads.instagram.py: Instagram Graph API integration for Reels.generated_images/: Temporary storage for generated image assets.generated_videos/: Temporary storage for generated video segments.output/: Final combined videos.
[Specify License Here]

