PHP code example of char0n / ffmpeg-php

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

    

char0n / ffmpeg-php example snippets



Char0n\FFMpegPHP\Movie;

$movie = new Movie('./test.mp4');
var_dump($movie->getDuration());

use Char0n\FFMpegPHP\Movie;

$movie = new Movie('/path/to/media.mpeg');
$movie->getDuration(); // => 24

use Char0n\FFMpegPHP\Adapters\FFMpegMovie as ffmpeg_movie;

$movie = new ffmpeg_movie('/path/to/media.mpeg');
$movie->getDuration(); // => 24
bash
$ php composer.phar install
bash
$ wget https://github.com/char0n/ffmpeg-php/raw/master/tests/data/test.mp4
bash
$ php test.php