2017 © Pedro Peláez
 

library media-alchemyst

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

image

media-alchemyst/media-alchemyst

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

  • Thursday, May 3, 2018
  • by romain
  • Repository
  • 10 Watchers
  • 63 Stars
  • 89,945 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 10 Forks
  • 1 Open issues
  • 32 Versions
  • 3 % Grown

The README.md

MediAlchemyst

A PHP 7.0+ lib to transmute media files., (*1)

CircleCI, (*2)

  • 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., (*3)

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 :, (*4)

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 !, (*5)

Please note that Media-Alchemyst service provider requires MediaVorus service provider., (*6)

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 :, (*7)

$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 :), (*8)

The Versions

22/07 2013

0.1.x-dev

0.1.9999999.9999999-dev

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

  Sources   Download

MIT

The Requires

 

image audio video video processing image processing audio processing

16/10 2012

0.1.1

0.1.1.0

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

  Sources   Download

MIT

The Requires

 

The Development Requires

image audio video video processing image processing audio processing

18/07 2012

0.1

0.1.0.0

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

  Sources   Download

MIT

The Requires

 

The Development Requires

image audio video video processing image processing audio processing