PHP code example of pulse00 / ffmpeg-bundle
1. Go to this page and download the library: Download pulse00/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/ */
pulse00 / ffmpeg-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Dubture\FFmpegBundle\DubtureFFmpegBundle(),
// ...
);
}
$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');