Skip to content

alexlitinsky/clipper-nodejs-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipper: AI-Powered Viral Clip Generator

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.

Features

  • 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.

How It Works

  1. Fetch Captions: Downloads the auto-generated or provided captions for a given YouTube URL.
  2. 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.
  3. Download Video: Downloads the high-quality source video from YouTube.
  4. Render Clips: For each selected segment, it uses ffmpeg to:
    • 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.
  5. Save Clips: The final .mp4 files are saved in the /clips directory.

Prerequisites

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.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/clipper.git
    cd clipper
  2. Install dependencies:

    npm install
  3. Set up your environment:

    • Create a file named .env in the root of the project.
    • Add your OpenAI API key to the .env file:
      OPENAI_API_KEY=your_openai_api_key_here
      

Usage

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.

Dependencies

  • 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 .env file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published