Skip to content

Generate voice narration for videos by analyzing frames with OpenAI's API and combine the narration with the video using `PHP-FFmpeg` to ensure seamless synchronization. Great for adding context or commentary to video content.

Notifications You must be signed in to change notification settings

alaminfirdows/vision-ai-video-narration-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Narration with OpenAI and FFmpeg

This project uses OpenAI's API to extract text information from video frames and generate voice narration. It integrates PHP-FFmpeg to combine the generated voice with the original video. The goal is to create a seamless narration that matches the visual content.

Features

  • Frame Analysis: Uses OpenAI's API to analyze video frames and extract text.
  • Text-to-Speech: Converts extracted text into voice narration.
  • Video Editing: Integrates PHP-FFmpeg to merge the generated voice with the video.
  • Synchronization: Ensures the voice narration syncs accurately with the video content.

Getting Started

To run this project, you'll need:

  • PHP and the PHP-FFmpeg library installed
  • Access to OpenAI's API for text analysis and text-to-speech
  • A sample video file to process

Installation

  1. Clone the repository:
git clone [email protected]:alaminfirdows/vision-ai-video-narration-php.git
  1. Install the required dependencies:
composer install
  1. Set up your OpenAI API key in src/Application.php:
$this->openAi = OpenAI::client(''); // Add your OpenAI API key here
  1. Run the script to generate a new video with voice narration:
hp -S localhost:8080 -t index.php
  1. Access the script in your browser:
http://localhost:8080

Usage

  1. Extract text information from video frames using OpenAI's API.
  2. Convert the extracted text into voice narration.
  3. Combine the narration with the original video using PHP-FFmpeg.
  4. Output a new video with voice narration.

Contributing

Contributions and feedback are welcome! Please feel free to submit issues or pull requests to improve the project.

About

Generate voice narration for videos by analyzing frames with OpenAI's API and combine the narration with the video using `PHP-FFmpeg` to ensure seamless synchronization. Great for adding context or commentary to video content.

Topics

Resources

Stars

Watchers

Forks

Languages