Video processing with Melt

https://www.mltframework.org
Buy on Codecanyon
PHP Class

$videoProcessing = new Andchir\VideoProcessing(['melt_path' => '/usr/bin/melt']);

Get Melt data

$videoProcessing->addOption(['version' => []]);
echo $videoProcessing->getOutput();
$videoProcessing->addOption(['query' => 'formats']);
echo $videoProcessing->getOutput();
$videoProcessing->addOption(['query' => 'transitions']);
echo $videoProcessing->getOutput();

Join clips

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['joinClips' => [
        $rootPath . '/uploads/tmp/Social.mp4',
        $rootPath . '/uploads/tmp/Dog.mp4',
        $rootPath . '/uploads/tmp/Swans.mp4'
    ]])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out1.mp4');        

Black color and fade transition

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        'colour:black', ['out' => 24],
        $rootPath . '/uploads/tmp/Dog.mp4'
    ]])
    ->addOption(['mix' => 25])
    ->addOption(['mixer' => 'luma'])
    ->addOption(['inputSource' => [
        'colour:black', ['out' => 24]
    ]])
    ->addOption(['mix' => 25])
    ->addOption(['mixer' => 'luma'])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out2.mp4');        

Join clips with transition

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4',
        $rootPath . '/uploads/tmp/Dog.mp4'
    ]])
    ->addOption(['mix' => 25])
    ->addOption(['mixer' => 'luma'])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out3.mp4');        

Cut clips and join with transition

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Social.mp4', ['in' => 200, 'out' => 275]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('fade', 25)
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('shiftRightIn', 25, [
        'width' => 1280,
        'height' => 720
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out4.mp4');        

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->setOutputFormat('webm')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('shiftLeftIn', 25, [
        'inOpacity' => 0
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Social.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('shiftRightOut', 25, [
        'outWidth' => 0,
        'outHeight' => 0
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('shiftTopIn', 25)
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('shiftBottomOut', 25, [
        'outWidth' => 0,
        'outHeight' => 0
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out5.webm');        

Wipe transition

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('wipeIn', 37, [
        'softness' => '0.1'
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Social.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('wipeIn', 37, [
        'wipeName' => 'clock.pgm',
        'softness' => '0.05'
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('wipeOut', 37, [
        'wipeName' => 'clock.pgm',
        'softness' => '0.05'
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addReadyMadeTransition('wipeIn', 37, [
        'wipeName' => 'spiral.pgm',
        'softness' => '0.05'
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out6.mp4');        

Add background audio with delay

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->disableAudio()
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 200]
    ]])
    ->addReadyMadeTransition('shiftLeftIn', 25)
    ->addBackgroundAudio($rootPath . '/uploads/tmp/Reformat.mp3', ['in' => 0, 'out' => 150, 'delay' => 50])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out7.mp4');        

Add watermark

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 200]
    ]])
    ->addWatermark($rootPath . '/uploads/tmp/SampleLogo.png', false, [
        'distort' => 1
    ])
    ->addReadyMadeTransition('shiftLeftIn', 25)
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out8.mp4');        

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['in' => 50, 'out' => 125]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['in' => 50, 'out' => 200]
    ]])
    ->addReadyMadeTransition('shiftLeftIn', 25)
    ->addWatermark($rootPath . '/uploads/tmp/SampleLogo.png', true, [
        'width' => 300,
        'height' => 300,
        'left' => 0,
        'top' => 450
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out9.mp4');        

Add text overlay

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['out' => 120]
    ]])
    ->addTextOverlay('This is my best video', true, [
        'fgcolour' => '#004fed',
        'olcolour' => '#fff200',
        'outline' => 3,
        'pad' => '50x0',
        'size' => 80,
        'weight' => 700,
        'style' => 'italic',
        'halign' => 'center',
        'valign' => 'top',
        'family' => 'Ubuntu'
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out10.mp4')        

Animated text

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['out' => 120]
    ]])
    ->addTextOverlay('This is my best video', true, [
        'pad' => '50x0',
        'size' => 80,
        'halign' => 'center',
        'valign' => 'top',
        'family' => 'Ubuntu',
        'slideFrom' => 'bottom',
        'duration' => 50,
        'inOpacity' => 0,
        'outOpacity' => 100
    ])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out11.mp4');        

Slide show from static images + audio fade out

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/picture1.jpg', ['out' => 100]
    ]])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/picture2.jpg', ['out' => 100]
    ]])
    ->addReadyMadeTransition('wipeIn', 25, [
        'wipeName' => 'cloud.pgm'
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/picture3.jpg', ['out' => 100]
    ]])
    ->addReadyMadeTransition('wipeIn', 25, [
        'wipeName' => 'burst.pgm'
    ])
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/picture4.jpg', ['out' => 100]
    ]])
    ->addReadyMadeTransition('wipeIn', 25, [
        'wipeName' => 'radial-bars.pgm'
    ])
    ->addBackgroundAudio($rootPath . '/uploads/tmp/Reformat.mp3', ['out' => 100 * 4 - (24 * 3)])
    ->addOption(['filter' => [
        'volume',
        ['gain' => 1, 'end' => 0],
        ['in' => 200, 'out' => 100 * 4 - (24 * 3)]
    ]])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out12.mp4');        

Rendering

$videoProcessing
    ->setProfile('hdv_720_25p')
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Swans.mp4', ['out' => 120]
    ]])
    ->disableAudio()
    ->addOption(['inputSource' => [
        $rootPath . '/uploads/tmp/Dog.mp4', ['out' => 120]
    ]])
    ->addReadyMadeTransition('shiftLeftIn', 25)
    ->addBackgroundAudio($rootPath . '/uploads/tmp/Reformat.mp3', ['out' => 215])
    ->setOutputVideoOptions($rootPath . '/uploads/tmp/out.mp4');

// Start rendering in background
$progressLogPath = $videoProcessing->render();        

Rendering progress

// Optional arguments: log file path, PID
// Otherwise it is taken from the session
$percent = $videoProcessing->getRenderingPercent();