Automatically convert long-form podcast videos into engaging short-form content by combining them with gameplay footage and adding intelligent subtitles.
- Automatic Engagement Detection: Uses AI to find the most interesting moments in podcasts
- Split-Screen Format: Combines podcast (top) and gameplay (bottom) in 9:16 aspect ratio
- Intelligent Subtitles: Automatically generates and styles subtitles from transcript
- Audio Analysis: Detects volume spikes, sentiment changes, and speech patterns
- Text Analysis: Identifies questions, exclamations, and emotional content
- Batch Processing: Generate multiple clips from a single video
- YouTube Integration: Download videos directly from YouTube URLs
- Interactive Mode: User-friendly prompts for video URLs
- โ Background music (.mp3) - Coming soon
- โ Captions (.srt) - Automatic generation
- โ Podcast recording video (.mp4) - From YouTube or local file
- โ Gameplay video (.mp4) - From YouTube or local file
- โ Length (15-60 seconds) - Automatic optimization
- Title suggestions
- Description templates
- Thumbnail generation
-
Clone the repository:
git clone <your-repo-url> cd YoutubeToShorts
-
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install FFmpeg (required for video processing):
- macOS:
brew install ffmpeg - Ubuntu:
sudo apt install ffmpeg - Windows: Download from FFmpeg website
- macOS:
Simply run the pipeline and enter YouTube URLs when prompted:
python3 clips.pyOr use the CLI with interactive mode:
python3 run_pipeline.py --interactiveThe program will:
- Ask for podcast YouTube URL
- Ask for gameplay YouTube URL
- Ask how many clips to generate
- Download videos automatically
- Process and generate shorts
# Download from YouTube URLs
python3 run_pipeline.py --podcast-url "https://youtube.com/watch?v=..." --gameplay-url "https://youtube.com/watch?v=..." --clips 5
# Alternative syntax
python3 run_pipeline.py --podcast-youtube "https://youtube.com/watch?v=..." --gameplay-youtube "https://youtube.com/watch?v=..." --clips 5# Use local video files
python3 run_pipeline.py --podcast savedVideos/main_vid.mp4 --gameplay gamePlayVid/gameplay.mp4 --clips 5# Download podcast from YouTube, use local gameplay
python3 run_pipeline.py --podcast-url "https://youtube.com/watch?v=..." --gameplay gamePlayVid/gameplay.mp4 --clips 5CLI Options:
--podcast-url, -pu: YouTube URL for podcast video--gameplay-url, -gu: YouTube URL for gameplay video--podcast, -p: Path to local podcast video file--gameplay, -g: Path to local gameplay video file--clips, -n: Number of clips to generate (default: 5)--output-dir, -o: Output directory (default: outputs)--verbose, -v: Enable verbose output--interactive, -i: Run in interactive mode
from clips import YouTubeToShortsPipeline
# Initialize pipeline
pipeline = YouTubeToShortsPipeline()
# Download videos from YouTube
podcast_path = pipeline.download_youtube_video(
"https://youtube.com/watch?v=...",
"savedVideos",
"podcast"
)
gameplay_path = pipeline.download_youtube_video(
"https://youtube.com/watch?v=...",
"gamePlayVid",
"gameplay"
)
# Run complete pipeline
clips = pipeline.process_pipeline(
podcast_path=podcast_path,
gameplay_path=gameplay_path,
num_clips=3
)
print(f"Generated {len(clips)} clips!")- Podcast Video: Long-form content (e.g., interviews, discussions) - from YouTube URL or local file
- Gameplay Video: Background footage (e.g., Minecraft, Fortnite, Valorant) - from YouTube URL or local file
The system analyzes both audio and text to find high-engagement segments:
Audio Analysis:
- Volume spikes and changes
- Spectral centroid (brightness)
- Zero crossing rate (speech activity)
Text Analysis:
- Sentiment analysis (positive/negative emotions)
- Question detection
- Exclamation detection
- Laughter patterns
- Optimal word count
- Extracts high-engagement segments (15-60 seconds)
- Creates split-screen format (podcast top, gameplay bottom)
- Optimizes for 9:16 aspect ratio (Shorts format)
- Uses OpenAI Whisper for accurate transcription
- Automatically times subtitles to audio
- Styled with white text and black outline
- Positioned at bottom of screen
YoutubeToShorts/
โโโ clips.py # Main pipeline implementation
โโโ run_pipeline.py # CLI interface
โโโ config.py # Configuration settings
โโโ requirements.txt # Python dependencies
โโโ youtubeDownloader.py # Video download utilities
โโโ test_pipeline.py # Test script
โโโ savedVideos/ # Downloaded podcast videos
โโโ gamePlayVid/ # Downloaded gameplay videos
โโโ outputs/ # Generated short clips
โโโ transcripts/ # Generated transcripts
โโโ temp/ # Temporary files
โโโ audio_segments/ # Audio processing files
Edit config.py to customize:
- Video settings: Resolution, codec, FPS
- Engagement analysis: Weights, duration limits
- Subtitle styling: Font, size, colors
- Whisper settings: Model size, language
def _analyze_text_engagement(self, text: str) -> float:
# Add your custom patterns here
custom_patterns = ['your_keyword', 'another_pattern']
# ... existing code ...def make_subtitle(txt):
return TextClip(
txt,
font='Your-Font',
fontsize=50,
color='yellow',
stroke_color='blue',
stroke_width=3
).set_position(('center', 'top'))-
FFmpeg not found:
# Install FFmpeg first brew install ffmpeg # macOS sudo apt install ffmpeg # Ubuntu
-
Whisper model download:
- First run will download the model (~1GB)
- Ensure stable internet connection
-
YouTube download issues:
- Check internet connection
- Verify YouTube URL is valid
- Some videos may be restricted
-
Memory issues:
- Use smaller Whisper model: Change
"base"to"tiny"in config - Process shorter videos first
- Use smaller Whisper model: Change
-
Video format issues:
- Ensure videos are in common formats (MP4, MOV, AVI)
- Check video codec compatibility
- Use SSD storage for faster processing
- Close other applications during processing
- Use smaller Whisper models for faster transcription
- Process videos in smaller batches
-
Run interactive mode:
python3 clips.py
-
Enter URLs when prompted:
๐ป Enter the YouTube URL for the podcast video: https://youtube.com/watch?v=... ๐ฎ Enter the YouTube URL for the gameplay video: https://youtube.com/watch?v=... ๐ How many clips to generate? (default: 3): 5 -
Wait for processing:
- Videos will be downloaded automatically
- Audio will be transcribed
- Engagement segments will be analyzed
- Short clips will be generated
python3 run_pipeline.py \
--podcast-url "https://youtube.com/watch?v=podcast_video_id" \
--gameplay-url "https://youtube.com/watch?v=gameplay_video_id" \
--clips 3 \
--verbose- Background music integration
- Advanced subtitle animations
- YouTube upload automation
- Thumbnail generation
- Multiple gameplay video support
- Web interface
- Real-time processing
- Custom engagement patterns
- Batch processing from playlists
This project is licensed under the Apache License- see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
If you encounter any issues or have questions:
- Check the troubleshooting section
- Search existing issues
- Create a new issue with detailed information