1. Go to this page and download the library: Download mikeambait/ffmpeglaravel 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/ */
// params> width: integer( value in resize() to force the use of the nearest aspect ratio standard.
$resizedVideo = FFMpegLaravel::open(public_path() . '/egg.mp4')
->resize(640, 480)
->save(public_path() . '/resized_egg.mp4', [
'bitrate' => 500,
'audio' => 256
]);
// getThumbnail() , generates thumbnail at 10 secs mark, when no params passed
FFMpegLaravel::open('videos.mp4')
->getThumbnail(public_path() . '/filename.jpg');
// returns a integer of duration in seconds
$duration = FFMpegLaravel::open(public_path() . '/egg.mp4')
->getDuration();
echo $duration;
// parameters: new filepath.gif | duration of GIF file : int(nullable) | from seconds: int(nullable)
$gif = FFMpegLaravel::open(public_path() . '/egg.mp4')
->generateGif(public_path() . '/sample.gif', 2 );
return $gif;
// returns an array of resolution of the video: 'width' & 'height'
$resolution = FFMpegLaravel::open(public_path() . '/egg.mp4')
->getResolution();
echo $resolution['width'] .' x '.$resolution['height'];
// returns a string of codec used by the video
$codec = FFMpegLaravel::open(public_path() . '/egg.mp4')
->getCodec();
echo $codec;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.