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.
- 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.
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
- Clone the repository:
git clone git@github.com:alaminfirdows/vision-ai-video-narration-php.git
- Install the required dependencies:
composer install
- Set up your OpenAI API key in
src/Application.php
:
$this->openAi = OpenAI::client(''); // Add your OpenAI API key here
- Run the script to generate a new video with voice narration:
hp -S localhost:8080 -t index.php
- Access the script in your browser:
http://localhost:8080
- Extract text information from video frames using OpenAI's API.
- Convert the extracted text into voice narration.
- Combine the narration with the original video using
PHP-FFmpeg
. - Output a new video with voice narration.
Contributions and feedback are welcome! Please feel free to submit issues or pull requests to improve the project.