This project automates the creation of a video by fetching content from the Reddit subreddit AmItheAsshole
, generating speech from the text, speeding up the audio, editing a video file, adding subtitles, and exporting the final video with embedded subtitles.
Before running the script, make sure you have Python installed on your system. The script requires the following Python libraries:
- moviepy
- gTTS
- python-dotenv
- assemblyai
- pysrt
- pydub
- praw
You will also need to have FFmpeg installed, as it is used by moviepy
for video processing.
- Clone the repository or download the source code.
- Navigate to the directory containing the project files.
- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use
venv\Scripts\activate
- Install the required Python libraries by running: pip install -r requirements.txt
- Rename .env.example to .env.
- Fill in the required API keys and other configuration settings in the .env file: CLIENT_ID, CLIENT_SECRET, and USER_AGENT for Reddit API access. ASSEMBLYAI_API_KEY for using AssemblyAI's transcription services.
- Both the AssemblyAI API and Reddit API are free, only requires account creation
- python video_creator.py
- Fetch the most recent post from the selected subreddit.
- Generate speech from the post content using Google's Text-to-Speech service.
- Edit the video by adjusting speed, applying a crop, and setting the audio.
- Automatically generate subtitles and embed them into the video.
- Export the final video to a specified directory.
The script saves the final video along with intermediate files in the generated directory. Ensure to check this directory for all generated content.