1.1.3 • Published 10 months ago

videogen v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

VideoGen

VideoGen is an NPM module that transforms a textual prompt into a complete video story. It utilizes AI for generating narratives, fetches relevant video clips, generates synthesized audio, and adds subtitles, producing a final, polished video.

Features

  • AI-Powered Story Generation: Create engaging stories from user-provided prompts.
  • Keyword Extraction: Identify key phrases from the story to guide video content selection.
  • Video Retrieval: Fetch relevant video clips from Pexels.
  • Text-to-Speech: Generate audio narration using Google Text-to-Speech.
  • Subtitle Integration: Automatically generate and embed subtitles.
  • Final Video Composition: Assemble video segments, audio, and subtitles into a cohesive final product.

Installation

Install the module via npm:

npm install videogen

First create a .env file to store your API keys:

OPENAI_KEY=
OPENAI_MODEL=gpt-3.5-turbo
PEXEL_API_KEY=
GOOGLE_APPLICATION_CREDENTIALS=
OPENAI_TRANSCRIPTION_MODEL=whisper-1
OUTPUT_DIRECTORY=

Usage

const { videogen } = require("videogen");

videogen({
    prompt: 'Le football et ses risques',
    hasSubtitle: false,
    orientation: 'portrait',
    uuid: 'aa285bf5-e8f2-4e27-b6e3-138cf73f8f58',
    language: 'en-US',
    voice: 'en-US-Standard-C',
    duration: 20,
    onSuccess: async (uuid, videoPath) => {
        // DO Someting here
    },
    onFailed: async (uuid, err) => {
        // DO Someting here
    }
})
VariableTypeDescription
promptstring (Minimum 30 characters)The text used to generate content. Must be at least 30 characters long to provide sufficient context.
hasSubtitleboolean (Default: 1)Specifies whether subtitles should be generated and included in the video. By default, this option is enabled (true).
orientationstring (landscape or portrait) (Default: landscape)Defines the video's orientation. Use landscape for a horizontal video or portrait for a vertical one. The default value is landscape.
uuidstring (Optional)Optional unique identifier for the video. Can be used to track or specifically identify a video.
languagestring (Optional) (Default: en-US)Language of the text and voice. Specify a language code following the BCP 47 standard. By default, en-US (English - United States) is used.
voicestring (Optional) (Default: en-US-Standard-C)Voice for text-to-speech narration. By default, en-US-Standard-C is used. This value may vary depending on available voices.
durationint (Required)Total duration of the video in seconds. This value is required and must be specified as a whole number of seconds.
onSuccessasync function (Required)Asynchronous function called when the video is successfully generated. Receives the parameters uuid (unique identifier) and finalVideoPath (path to the final video file).
onFailedasync function (Required)Asynchronous function called if video generation fails. Receives the parameters uuid (unique identifier) and err (error encountered).

Configuration

Pexels API Key

To fetch video content, you need a Pexels API key. You can obtain it by signing up on the Pexels API website.

Google Text-to-Speech

To generate audio, you need Google Cloud Text-to-Speech credentials. Follow the Google Cloud setup instructions to obtain your credentials.

OpenAI

To generate content, you need OpenAI API credentials. Follow the OpenAI setup instructions to obtain your credentials.

Contributing

We welcome contributions! Please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.

Acknowledgements

  • Pexels for providing free video content.
  • Google Cloud for the Text-to-Speech API.
  • OpenAI for GPT-based story generation.

Support

For any issues or questions, please open an issue on the GitHub repository.

Enjoy creating story-based videos!

1.1.3

10 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago