PHP code example of media-alchemyst / media-alchemyst

1. Go to this page and download the library: Download media-alchemyst/media-alchemyst 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/ */

    

media-alchemyst / media-alchemyst example snippets


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);


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())

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());