PHP code example of fmonts / ffmpeg-bundle

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

    

fmonts / ffmpeg-bundle example snippets


class VideoController extends AbstractController
{
    public function resize(FFMpeg $FFMpeg): Response
    {
        // Open video
        $video = $FFMpeg->open('/your/source/folder/input.avi');
        
        // Resize to 1280x720
        $video
          ->filters()
          ->resize(new Dimension(1280, 720), ResizeFilter::RESIZEMODE_INSET)
          ->synchronize();
        
        // Start transcoding and save video
        $video->save(new X264(), '/your/target/folder/video.mp4');
    }
}