media-alchemyst / media-alchemyst
An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs
Installs: 207 481
Dependents: 1
Suggesters: 0
Security: 0
Stars: 66
Watchers: 11
Forks: 12
Open Issues: 2
Requires
- php: >=5.3.3
- alchemy/ghostscript: ~0.4.0
- alchemy/mediavorus: ^0.4.4
- imagine/imagine: ^0.11.0
- monolog/monolog: ~1.0
- neutron/temporary-filesystem: ^2.1.1
- php-ffmpeg/php-ffmpeg: ^v0.15
- php-mp4box/php-mp4box: ~0.3.0
- php-unoconv/php-unoconv: ~0.3.1
- pimple/pimple: ~1.0
- swftools/swftools: ~0.3.0
- symfony/console: ^2.1|^3.0
- symfony/filesystem: ^2.1|^3.0
- symfony/process: ^2.1.1|^3.0
Requires (Dev)
- alchemy/phpexiftool: ^0.4.0|^0.5.0
- neutron/silex-imagine-provider: ~0.1
- phpunit/phpunit: ^4.1|^5.0
- silex/silex: ~1.0
- v4.1.9
- v4.1.8
- 4.1.0
- dev-master / 0.5.x-dev
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3.x-dev
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-PHRAS-3852_background-color
- dev-PHRAS-3785-update-imagine
This package is auto-updated.
Last update: 2024-09-12 18:29:22 UTC
README
A PHP 7.0+ lib to transmute media files.
- Want to extract audio from a video file ?
- Want to convert an office document to an image?
- Want to resize images ?
- Want to generate a Gif animation from a video ?
Media-Alchemyst is a tool to transmute your medias from media-type to media-type.
Usage example
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);
What is currently supported ?
- Working install of FFmpeg (for Audio / Video processing)
- GPAC (for X264 Video processing)
- Perl (for metadata analysis)
- GraphicsMagick and its Gmagick PHP Extension (recommended) or ImageMagick (Image processing)
- Universal Office Converter (unoconv) which supports about 100 different document formats
- SWFTools (for Flash files processing)
Customize drivers
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())
Silex service provider ?
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
));
License
This is MIT licensed, enjoy :)