Clipper is a command-line tool that automatically generates short, engaging, "viral-style" video clips from any YouTube video. It uses AI to analyze the video's transcript, identify the most compelling segments, and then renders them into vertical videos with burned-in captions, perfect for social media.
- AI-Powered Clip Selection: Leverages OpenAI's GPT-5 to analyze video transcripts and identify the most engaging moments.
- Automatic Captioning: Fetches subtitles and burns them directly into the video clips.
- Vertical Video Formatting: Automatically crops and resizes videos to a 1080x1920 vertical format.
- Simple CLI: Easy to use with a single command.
- Fetch Captions: Downloads the auto-generated or provided captions for a given YouTube URL.
- Analyze Transcript: Sends the full transcript to GPT-5, which acts as a "viral video producer" to select the 3-5 best clip-worthy segments.
- Download Video: Downloads the high-quality source video from YouTube.
- Render Clips: For each selected segment, it uses
ffmpegto:- Cut the video to the specified start and end times.
- Reformat the video to a vertical aspect ratio.
- Create and burn in stylized captions for readability.
- Save Clips: The final
.mp4files are saved in the/clipsdirectory.
Before you begin, you need to have the following installed:
- Node.js (v18 or higher recommended)
- ffmpeg - The command-line tool must be available in your system's PATH.
-
Clone the repository:
git clone https://github.com/your-username/clipper.git cd clipper -
Install dependencies:
npm install
-
Set up your environment:
- Create a file named
.envin the root of the project. - Add your OpenAI API key to the
.envfile:OPENAI_API_KEY=your_openai_api_key_here
- Create a file named
Run the tool from your terminal, providing a YouTube video URL as the argument:
node createClips.js "https://www.youtube.com/watch?v=your_video_id"The script will start processing the video. You'll see logs in the console as it fetches captions, analyzes the transcript, downloads the video, and renders the clips.
Once finished, you will find the generated clips in the /clips directory.
- yt-dlp-wrap: A Node.js wrapper for
yt-dlp. - fluent-ffmpeg: A Node.js wrapper for
ffmpeg. - openai: The official OpenAI Node.js library.
- dotenv: Loads environment variables from a
.envfile.