PHP code example of azraelir / ffmpeg-bundle

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

    

azraelir / ffmpeg-bundle example snippets



// config/bundles.php

return [
    // ...
    Dubture\FFmpegBundle\DubtureFFmpegBundle::class => ['all' => true],
];

$ffmpeg = $this->get('dubture_ffmpeg.ffmpeg');

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