PHP code example of gauravgpil / php-video-automator
1. Go to this page and download the library: Download gauravgpil/php-video-automator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gauravgpil / php-video-automator example snippets
use PhpVideoAutomator\VideoAutomator;
$config = [
'ffmpeg_path' => '/usr/bin/ffmpeg', // Optional, defaults to 'ffmpeg'
'ai_image_api_key' => 'sk-your-openai-key',
'pixabay_api_key' => 'your-pixabay-key',
'pexels_api_key' => 'your-pexels-key',
'coverr_api_key' => 'your-coverr-key',
];
$automator = new VideoAutomator($config);
$automator->fromImages()
->setScript("Welcome to our AI channel. Today we learn about the future.")
->generateImages() // Uses OpenAI by default
->addAnimation('ken-burns')
->withCaptions(true)
->export('/var/www/output_ai_video.mp4');
$automator->fromStockVideos()
->setScript("Beautiful waterfalls and lush green nature forests.")
->fetchStockVideos('wikimedia', '', ['randomize' => true, 'count' => 3])
->addTransitions('fade')
->export('/var/www/output_stock_video.mp4');
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.