Skip to content

Takes a given script, and generates a video based on it.

Notifications You must be signed in to change notification settings

the-innovation-squad/content-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎥 Content Renderer

This tool is designed for rendering videos with a given script and corresponding video clips. It combines the script being read by an AI-generated voice with the provided video clips to create a final video. Please note that this application does not source content or footage; it only renders videos based on the input provided. The content and footage should be prepared separately with the script-writer and provided through the input YAML file.

The project uses the Eleven Labs API to generate the voice narration and MoviePy for video editing.

📜 Example Input

Takes a file input/settings.yml in the following format:

watermark: "https://i.imgur.com/NbzMg2q.png" # optional, default False
captions: True # optional, default False
resolution: "720, 1080" # optional, default "1920, 1080"
engine: "eleven" # one of ["eleven", "google"], default "google"
engine_settings: # optional per engine settings, check the code in scripts/tts_engines/... for specifics & defaults
  voice_id: "ErXwobaYiN019PkySvjV"

And a script input/script.yml like the following:

timeline:
  - content: "Welcome to our video! This is the first scene with an AI-generated voice."
    clip: "https://www.pexels.com/download/video/6394054/"
  - content: "Now, we're moving to the second scene. Enjoy the visuals!"
    engine: "google" # global engine can be overridden for individual timeline items
    engine_settings: # as above, per engine settings can be overridden for individual timeline items
      ssml_gender: "MALE"
    clip: "https://www.pexels.com/download/video/2034291/"
  - content: "That's it for our video. Thanks for watching and stay tuned for more content!"
    clip: "https://www.pexels.com/download/video/3150358/?fps=25.0&h=1080&w=2048"

🖨️ Example Output

final.mp4

⚙️ Setup and Installation

  1. Clone the repository to your local machine.

  2. Copy the .env.sample file, rename it to .env, and fill in the values:

    cp .env.sample .env
  3. Install the required Python packages:

    pip3 install -r requirements.txt
  4. If you are on macOS, you may need to install the ffmpeg and imagemagick libraries: If you don't have Homebrew installed, you can follow the installation instructions on their website: https://brew.sh/.

    brew install ffmpeg # required for MoviePy to work
    brew install imagemagick # required for MoviePy to support captions

Environment Variables

🚀 Running the App

  1. To run the app, simply execute the following command:
    python3 scripts/main.py
    This will create a video based on the input script and stock video clips provided in the input/video_script.yml file. The final video will be saved in the output directory.

🔧 Available Arguments

Short Long Description Type
-d --debug Enable debug mode, and skip tts generation Flag (boolean)

📖 How the App Works

The app works in the following steps:

  1. Read the input script and video clips from the input/video_script.yml file.

  2. Generate the voice narration using the Eleven Labs API or use a pre-generated audio file in debug mode.

  3. Create video segments for each timeline item in the input script, combining the video clips with the generated voice narration.

  4. Concatenate the video segments together to produce the final video.

  5. Save the final video in the output directory.

Feel free to modify and enhance the README to better suit your project's needs.

About

Takes a given script, and generates a video based on it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages