Skip to content

SlightlyHappy/RedditStories2Video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Reddit to TikTok Video Generator ![Status](https://img.shields.io/badge/status-active-brightgreen) ![Python Version](https://img.shields.io/badge/python-3.8%2B-blue) ![License](https://img.shields.io/badge/license-MIT-green) This application automatically creates TikTok-style videos from Reddit content by converting Reddit posts into narrated videos with subtitles overlaid on background footage. The application follows a modular design pattern for easy maintenance and future enhancements. Overview The Reddit to TikTok Video Generator automates the creation of engaging social media content by: Extracting content from Reddit posts via URL Converting text to speech using Hugging Face AI models Adding synchronized subtitles to match the narration Overlaying everything on background gameplay footage Producing a final video ready for TikTok upload Core Modules 1. Reddit Content Extractor This module handles fetching and parsing content from Reddit: Accepts Reddit post URLs as input Authenticates with Reddit API (using PRAW or similar) Extracts post title, body text, and relevant metadata Cleans and formats text for narration Handles different post types (text posts, AITA, relationship advice, etc.) 2. Text-to-Speech Engine This module converts the extracted text to natural-sounding narration: Integrates with Hugging Face text-to-speech models Supports voice selection and customization Generates audio files with appropriate pacing and intonation Handles timing information for subtitle synchronization Optimizes audio quality for TikTok platform 3. Subtitle Generator This module creates synchronized subtitles: Generates subtitle text from the Reddit content Timestamps subtitles to match the audio narration Formats subtitles for visual appeal (font, color, size) Supports different subtitle styles and animations Ensures readability against various background videos 4. Video Background Manager This module handles the background video content: Maintains a library of background gameplay videos Selects appropriate videos based on content length or theme Crops/resizes videos to TikTok's preferred aspect ratio Manages video transitions if multiple clips are needed Optimizes video quality for final output 5. Video Compositor This module combines all elements into the final video: Overlays subtitles on the background video Synchronizes audio narration with visual elements Adds any intro/outro elements or branding Applies visual effects or transitions as needed Renders the final video in TikTok-compatible format 6. User Interface This module provides interaction with the application: Simple input field for Reddit post URL Progress indicators for each processing stage Preview capability before final rendering Settings for customization (voice type, subtitle style, etc.) Output directory selection for final videos ## Technical Requirements - Python 3.8+ environment - Reddit API credentials (for PRAW) - Hugging Face API access for text-to-speech models ## Getting Started ### Installation 1. Clone the repository: ```bash git clone https://github.com/yourusername/RedditStoriesVideos.git cd RedditStoriesVideos ``` 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Create environment configuration: ```bash cp config/advanced_config.template config/.env ``` Edit the `.env` file with your API keys and preferences. 4. Download sample background videos: ```bash python download_sample_backgrounds.py ``` ### Usage 1. Run the application: ```bash # On Windows run.bat # On Linux/Mac ./run.sh ``` 2. Enter the Reddit post URL when prompted. 3. The application will process the content and generate a video in the `output/` directory. ## Configuration See `SETUP.md` for detailed configuration options and customization. ## Contributing Contributions are welcome! Please see `CONTRIBUTING.md` for guidelines. ## License This project is licensed under the MIT License - see the LICENSE file for details. FFmpeg for video processing Storage space for background video library Dependencies: PRAW, transformers, moviepy, pydub, etc. Usage Flow User inputs Reddit post URL Application extracts and processes the Reddit content Text is converted to speech using the selected voice model Subtitles are generated and synchronized with the audio Background video is selected from the library All elements are composed into the final video Video is rendered and saved to the specified location ## Getting Started To get started with this project: 1. Clone or download the repository 2. Install the required dependencies with `pip install -r requirements.txt` 3. Set up your Reddit API credentials and Hugging Face token in `config/.env` 4. Add background videos to the `data/backgrounds` directory 5. Convert your background videos to 9:16 format with `python main.py --convert-backgrounds` 6. Run the application with `python main.py` or use `run.bat` on Windows For detailed setup instructions, see the [SETUP.md](SETUP.md) file. ## Project Structure ``` . ├── config/ # Configuration files │ ├── .env.template # Template for API credentials │ └── advanced_config.template # Advanced configuration options ├── data/ # Data files │ └── backgrounds/ # Background videos ├── src/ # Source code │ ├── modules/ # Core modules │ │ ├── reddit_extractor/ # Reddit content extraction │ │ ├── tts_engine/ # Text-to-speech conversion │ │ ├── subtitle_generator/ # Subtitle generation │ │ ├── video_background/ # Background video management │ │ └── video_compositor/ # Final video composition │ └── ui/ # User interface ├── main.py # Main entry point ├── download_sample_backgrounds.py # Script to download sample backgrounds ├── requirements.txt # Python dependencies ├── run.bat # Windows launcher script ├── SETUP.md # Setup guide ├── test_system.py # System test script └── readme.md # This file ``` ## Usage Examples ### GUI Mode Run the application with a graphical user interface: ``` python main.py ``` ### Headless Mode Generate a video from a Reddit post without the GUI: ``` python main.py --headless --url "https://www.reddit.com/r/SUBREDDIT/comments/POST_ID/" --output "output_directory" ``` ### Batch Processing Process multiple Reddit posts from a CSV file: ``` python main.py --batch "path/to/urls.csv" --output "output_directory" --delay 5 ``` Or use the dedicated batch processing script for more options: ``` python batch_process.py "path/to/urls.csv" --output "output_directory" --delay 5 --continue-on-error --limit 10 ``` The CSV file should contain one Reddit URL per line: ``` https://www.reddit.com/r/subreddit1/comments/post_id1/ https://www.reddit.com/r/subreddit2/comments/post_id2/ ... ``` ### Background Video Conversion Convert all background videos to the required 9:16 aspect ratio: ``` python main.py --convert-backgrounds ``` You can also use the dedicated conversion script for more options: ``` python convert_background_videos.py --folder "path/to/videos" --aspect "9:16" ``` ### Testing the System Verify that your setup is working correctly: ``` python test_system.py ``` Run the integration tests to check component interactions: ``` python tests/test_integration.py ``` ### Downloading Sample Backgrounds Download some sample background videos for testing: ``` python download_sample_backgrounds.py ``` Customization Options Voice selection (male/female, accent, tone) Subtitle styling (font, color, animation) Background video preferences Video aspect ratio (9:16 for TikTok, 16:9 for YouTube) Intro/outro customization Content filtering options Error Handling The application includes robust error handling for: Invalid Reddit URLs API rate limiting Text-to-speech processing failures Video rendering issues File system errors Future Enhancements Batch processing of multiple Reddit posts AI-based content selection from subreddits Automated upload to TikTok Content moderation features Analytics for video performance This modular design ensures each component can be developed, tested, and improved independently, making the application maintainable and extensible for future requirements.# RedditStories2Video

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published