Yannick Warnier 76a0eae5ea Add static resources and remove tests dir for beta release | %!s(int64=5) %!d(string=hai) anos | |
---|---|---|
.. | ||
bin | %!s(int64=5) %!d(string=hai) anos | |
docs | %!s(int64=5) %!d(string=hai) anos | |
src | %!s(int64=5) %!d(string=hai) anos | |
tests | %!s(int64=5) %!d(string=hai) anos | |
.gitignore | %!s(int64=5) %!d(string=hai) anos | |
.travis.yml | %!s(int64=5) %!d(string=hai) anos | |
CHANGELOG.md | %!s(int64=5) %!d(string=hai) anos | |
LICENSE | %!s(int64=5) %!d(string=hai) anos | |
README.md | %!s(int64=5) %!d(string=hai) anos | |
composer.json | %!s(int64=5) %!d(string=hai) anos | |
phpunit.xml.dist | %!s(int64=5) %!d(string=hai) anos |
A PHP 5.3+ lib to transmute media files.
Media-Alchemyst is a tool to transmute your medias from media-type to media-type.
use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Animation;
use MediaAlchemyst\Specification\Image;
use MediaAlchemyst\Specification\Video;
$alchemyst = Alchemyst::create();
$video = new Video();
$video->setDimensions(320, 240)
->setFramerate(15)
->setGOPSize(200);
// AMAZING
$alchemyst
->turnInto('movie.mp4', 'animation.gif', new Animation())
->turnInto('movie.mp4', 'screenshot.jpg', new Image())
->turnInto('movie.mp4', 'preview.ogv', $video);
Drivers preferences can be specified through the DriversContainer
:
use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\DriversContainer;
$drivers = new DriversContainer();
$drivers['configuration'] = array(
'ffmpeg.threads' => 4,
'ffmpeg.ffmpeg.timeout' => 3600,
'ffmpeg.ffprobe.timeout' => 60,
'ffmpeg.ffmpeg.binaries' => '/path/to/custom/ffmpeg',
'ffmpeg.ffprobe.binaries' => '/path/to/custom/ffprobe',
'imagine.driver' => 'imagick',
'gs.timeout' => 60,
'gs.binaries' => '/path/to/custom/gs',
'mp4box.timeout' => 60,
'mp4box.binaries' => '/path/to/custom/MP4Box',
'swftools.timeout' => 60,
'swftools.pdf2swf.binaries' => '/path/to/custom/pdf2swf',
'swftools.swfrender.binaries' => '/path/to/custom/swfrender',
'swftools.swfextract.binaries' => '/path/to/custom/swfextract',
'unoconv.binaries' => '/path/to/custom/unoconv',
'unoconv.timeout' => 60,
);
$alchemyst = new Alchemyst($drivers);
$alchemyst
->turnInto('movie.mp4', 'animation.gif', new Animation())
Need a Silex service provider ? Of course it's provided !
Please note that Media-Alchemyst service provider requires MediaVorus service provider.
use Silex\Application;
use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\MediaAlchemystServiceProvider;
use MediaVorus\MediaVorusServiceProvider;
use PHPExiftool\PHPExiftoolServiceProvider;
$app = new Application();
$app->register(new PHPExiftoolServiceProvider());
$app->register(new MediaAlchemystServiceProvider());
// Have fun OH YEAH
$app['media-alchemyst']->turnInto('movie.mp4', 'animation.gif', new Animation());
You can customize the service provider with any of the following options :
$app->register(new MediaVorusServiceProvider(), array(
'media-alchemyst.configuration' => array(
'ffmpeg.threads' => 4,
'ffmpeg.ffmpeg.timeout' => 3600,
'ffmpeg.ffprobe.timeout' => 60,
'ffmpeg.ffmpeg.binaries' => '/path/to/custom/ffmpeg',
'ffmpeg.ffprobe.binaries' => '/path/to/custom/ffprobe',
'imagine.driver' => 'imagick',
'gs.timeout' => 60,
'gs.binaries' => '/path/to/custom/gs',
'mp4box.timeout' => 60,
'mp4box.binaries' => '/path/to/custom/MP4Box',
'swftools.timeout' => 60,
'swftools.pdf2swf.binaries' => '/path/to/custom/pdf2swf',
'swftools.swfrender.binaries' => '/path/to/custom/swfrender',
'swftools.swfextract.binaries' => '/path/to/custom/swfextract',
'unoconv.binaries' => '/path/to/custom/unoconv',
'unoconv.timeout' => 60,
),
'media-alchemyst.logger' => $logger, // A PSR Logger
));
This is MIT licensed, enjoy :)