dev-master
9999999-devFFMpeg Library
MIT
The Requires
The Development Requires
by Kaloyan Yosifov
1.0.0
1.0.0.0FFMpeg Library
MIT
The Requires
The Development Requires
by Kaloyan Yosifov
FFMpeg Library
FFMPEG library, available to anyone., (*1)
This library is create for personal use, but if you want to use it feel free to use it :) . To use it you will need to go deeper and see what the functions are doign, since it is a personal use i am not going to document everything, (*2)
First you need all of the libraries to use it, (*3)
use FFMpegLib\Initializer; use FFMpegLib\Executor\Executor; use FFMpegLib\Commands\VideoDurationCommand; use FFMpegLib\Commands\CreateImagesCommand; use FFMpegLib\Commands\GifCommand; use FFMpegLib\FileFinder\FileFinder;
Then you need to initalize it, (*4)
Initializer::initializeFFMpeg();
You can get video duration with, (*5)
$videoDurationCommand = new VideoDurationCommand('video.flv', APP_PATH); Executor::executeCommand($videoDurationCommand); $videoDurationCommand->getDuration(); // it returns an instance of Time
To create images suitable for gif:, (*6)
$imagesPath = APP_PATH . '/assets/images/image.png'; $videoPath = APP_PATH . '/assets/videos/video.flv'; $createImagesCommand = new CreateImagesCommand( $videoPath, $imagesPath, '00:30:40', '00:0:03', $videoDurationCommand->getDuration()); Executor::executeCommand($createImagesCommand);
Take note you need to delete the images yourself as the option is not yet implemented, (*7)
You can create a gif with:, (*8)
$gifCommand = new GifCommand(APP_PATH . '/assets/images/image.png', APP_PATH . '/assets/images/t.gif'); Executor::executeCommand($gifCommand);
You need to specify the full path of the video for every command except for the duration, there i use a finder for the base path, but you can pass the full path as well., (*9)
to get the images/frames created from createImagesCommand use, (*10)
$createImagesCommand->framesCreated();
The time Class, (*11)
methods:, (*12)
getSeconds(); //returns seconds, you need a Time object to call all of theese methods getMinutes(); getHours(); getFullTime(); getTimeInSeconds(); getTimeInMinutes(); create();// static method -- Time::create() createFromString(); // static method -- Time::createFromString()
FFMpeg Library
MIT
FFMpeg Library
MIT