This is a clips extractor tool that allows you to extract the most viral, funny, or interesting parts of a YouTube video based on the transcript, create subtitles, and crop the video around detected faces using OpenCV. It leverages the power of Whisper Timestamped for transcript extraction and ChatGPT 3.5 for content analysis.
This tool provides a convenient way to:
- Extract the transcript of a YouTube video using whisper_timestamped.
- Analyze the transcript with ChatGPT 3.5 to identify the most engaging parts.
- Cut the video at the identified times to create shorter clips.
- Generate subtitles for the clips.
- Automatically crop the video to focus on the detected faces using OpenCV.
To run the YouTube Clips Extractor, you'll need the following:
- FFMPEG
- ImageMagick
- Check the
requirements.txt
file.
-
Clone this repository:
git clone https://github.com/xjabr/viral-clips-extractor.git
-
Install the required Python packages:
pip install -r requirements.txt
-
Sign up for ChatGPT 3.5 and obtain your API credentials.
-
Configure the API credentials for ChatGPT 3.5 by update the variable
openai.api_key
incontents/chatgpt.py
file in the project directory.openai.api_key = '<your-token>'
-
Export cookies from tiktok.com using "Get cookies.txt LOCALLY" and save it in the root of the project as
cookies.txt
-
Run the application:
python clips_extractor.py --url <url>
This project was developed by:
- Gabriele Lanzafame (@xjabr) - GitHub Profile
If you'd like to contribute or report issues, please feel free to open an issue or submit a pull request.
We would like to thank the following libraries and services for making this project possible:
- moviepy by Zulko
- whisper-timestamped by linto-ai
- ChatGPT 3.5 by OpenAI
- OpenCV for face detection and video manipulation
Your contributions and feedback are highly appreciated!