1 Star 0 Fork 0

hehuolong / AI-Shorts-Creator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

#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:

  • Automatically extract captivating segments from videos.
  • Identify the most viral and exciting moments using GPT-4.
  • Crop videos to emphasize key highlights with precise face detection.
  • Streamline video editing and save time by eliminating manual searching.
  • Work seamlessly with various video formats for maximum compatibility.
  • Enhance the viewing experience for your audience with perfectly cropped highlights.

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

  • Python 3.x
  • pytube library (install with pip install pytube)
  • opencv-python library (install with pip install opencv-python)
  • openai library (install with pip install openai)
  • youtube-transcript-api library (install with pip install youtube-transcript-api)
  • FFmpeg (install according to your operating system)

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

  • The download_video(url, filename) function downloads a YouTube video by providing the URL and specifying the filename.
  • The segment_video(response) function segments the video into interesting sections based on a transcript analysis using OpenAI's GPT-4 model.
  • The detect_faces(video_file) function uses face detection to identify faces in a video file.
  • The crop_video(faces, input_file, output_file) function crops the video around the detected faces using FFmpeg.
  • The is_talking_in_batch(frames) function analyzes the lip movement or facial muscle activity within a batch of frames to determine if talking behavior is present.
  • The adjust_focus(frame, talking) function applies visual effects or adjustments to emphasize the speaker in the frame.

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.

空文件

简介

暂无描述 展开 收起
Jupyter Notebook 等 2 种语言
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/hehuolong_admin/AI-Shorts-Creator.git
git@gitee.com:hehuolong_admin/AI-Shorts-Creator.git
hehuolong_admin
AI-Shorts-Creator
AI-Shorts-Creator
main

搜索帮助

53164aa7 5694891 3bd8fe86 5694891