viral-clips-crew

repository·main·Indexed 20 days ago

https://github.com/alexfazio/viral-clips-crew

A CrewAI-powered video editing assistant that automates the repurposing of long-form video content into viral social media highlights. The tool extracts striking segments and adds subtitles using a pipeline involving Whisper for transcription, an AI crew for moment extraction, and integration with OpenAI and Google Gemini APIs.

Tokens
856
Snippets
4
Records
6
Agent score
23%

What's inside viral-clips-crew

  1. Configure API keys in .env

    main

    The project requires both an OpenAI API key and a Google Gemini API key. Create a .env file in the root directory and populate it with your keys using the following format:

    echo -e "OPENAI_API_KEY=<your-api-key>\nGEMINI_API_KEY=<your-api-key>" > .env
  2. Run viral-clips-crew to process video clips

    main

    To use the tool, place your video file into the input_files directory.

    Important Video Length Constraints:

    • Google Gemini: Can process videos up to 1 hour in length.
    • OpenAI API: Ensure the clip is less than 15 minutes in length (due to LLM context window limitations).

    Run the application using Poetry:

    poetry run python app.py

    Once the process completes, the final output will be located in the subtitler_output directory.

  3. Install viral-clips-crew

    main

    To install viral-clips-crew, you must have Python 3.7+ installed. The project uses Poetry for dependency management. Follow these steps:

    1. Clone the repository.
    2. Install Poetry via pip.
    3. Install project dependencies using poetry install.
    4. Update Pydantic using poetry update pydantic.
    5. Configure your API keys in a .env file.
    git clone https://github.com/alexfazio/viral-clips-crew.git
    pip install poetry
    poetry install
    poetry update pydantic
  4. Run the Viral Clips Crew application

    main

    The app.py file serves as the main entrypoint for the application. When executed, it orchestrates a multi-stage pipeline: downloading/loading video, transcribing via Whisper, extracting key moments using an AI crew, clipping the video to specific segments, and finally adding subtitles.

    Prerequisites:

    • You must have a .env file containing OPENAI_API_KEY and GEMINI_API_KEY.
    • The application will automatically create the following directories if they do not exist:
      • ./input_files
      • ./clipper_output
      • ./crew_output
      • ./whisper_output
      • ./subtitler_output

    Execution Flow:

    1. Input Selection: Choose between submitting a YouTube URL (uses ytdl_main) or using a local video file in ./input_files (uses local_whisper_process).
    2. Aspect Ratio: Select whether to keep the original aspect ratio or use a 1:1 (square) ratio.
    3. Extraction: The system runs extracts.main() to identify segments.
    4. Crew Processing: crew.main() processes the extracts.
    5. Clipping: clipper.main() cuts the video based on .srt files generated by the crew.
    6. Subtitling: subtitler.process_video_and_subtitles() burns the subtitles into the final trimmed videos.
    python app.py
  5. Troubleshoot 'NoneType' object is not iterable error

    main

    If you encounter the error TypeError: 'NoneType' object is not iterable, check the following:

    1. API Keys: Verify that your OPENAI_API_KEY and GEMINI_API_KEY are correctly set in your .env file.
    2. Account Credits: Ensure you have sufficient pay-as-you-go credits in both your OpenAI account and your Google Cloud account.
  6. Required environment variables

    main

    The application requires the following environment variables to be set in your environment or a .env file. If these are missing or set to the string 'None', the application will raise an EnvironmentError.

    • OPENAI_API_KEY: Required for AI-driven extraction/processing.
    • GEMINI_API_KEY: Required for AI-driven extraction/processing.