NisaarAgharia / AI-Shorts-Creator

AI-Video-Cropper is a Python-based tool that leverages the power of GPT-4 (OpenAI's language model) to automatically analyze videos, extract the most interesting sections, and crop them for improved viewing experience. This project combines the capabilities of GPT-4, FFmpeg, and OpenCV to automate the process of identifying highlights in videos
553 stars 111 forks source link
face-detection ffmpeg gpt4 openai opencv python youtube

AI-Shorts-Creator! 🎥✂️ (WIP, You Might face some Bugs)

AI-Shorts-Creator is a powerful tool designed for content creators, podcasters, and video enthusiasts to effortlessly extract captivating segments from their videos. Leveraging the advanced language model GPT-4, this innovative solution intelligently analyzes video transcripts to identify the most viral and exciting moments. By harnessing the capabilities of FFmpeg and OpenCV, AI-Shorts-Creator automatically crops videos, allowing you to focus on the key highlights and provide an enhanced viewing experience.

AI-Shorts-Creator is a powerful tool designed to:

Examples:

Source Video : https://www.youtube.com/watch?v=NHaczOsMQ20 thumbnail

Output Shorts:

Demo GIF 1 Demo GIF 2 Demo GIF 3

https://github.com/NisaarAgharia/AI-Shorts-Creator/assets/22457544/318c8cf1-bcc3-4ed7-a979-7af17e545e6e

Get started with AI-Shorts-Creator today and unlock the potential of your videos like never before!

Requirements

Usage

  1. Install the required libraries by running the following command:
pip install -r requirements.txt
  1. Install FFmpeg by following the installation instructions for your operating system. Make sure the ffmpeg command is accessible from the command line.

  2. Set up your OpenAI API key by replacing openai.api_key = '' with your actual OpenAI API key.

  3. Modify the video_id variable in the main() function to specify the YouTube video you want to process.

  4. Run the script:

python auto_cropper.py

The script will download the YouTube video, analyze its transcript using OpenAI's GPT-4, extract the best sections based on the analysis, crop the video using FFmpeg, and apply face detection using OpenCV to further refine the cropping.

Additional Information

Please note that the GPT-4 model and transcript analysis functionality in the provided code are simulated and not fully functional. You would need a valid OpenAI API key and a working GPT-4 model to perform transcript analysis.