PHP code example of appzz / video-converter

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

    

appzz / video-converter example snippets


use AppZz\VideoTools\FFmpeg;
to local binary files
**/
FFmpeg::$binary = '/usr/local/bin/ffmpeg';

$ff = FFmpeg::factory('video.mkv');

//set output dir
$ff->set('output_dir', 'pathto/finished')

//set mapping params
$ff->set('mapping', 'video', ['count'=>10])
$ff->set('mapping', 'audio', ['count'=>10])
$ff->set('mapping', 'subtitle', ['count'=>10])

//set codec params
$ff->set('vcodec', 'h264', ['b'=>'2000k', 'crf'=>FALSE, 'profile'=>'fast'])
$ff->set('acodec', 'aac', ['b'=>'128k', 'ac'=>2, 'ar'=>48000])
$ff->set('scodec', 'copy')

//set output format
$ff->format('mp4');
$ff->prepare();
$result = $ff->run();