2012-04-13 12:12:24 +02:00
|
|
|
#PHP FFmpeg
|
|
|
|
|
|
|
|
|
|
[](http://travis-ci.org/alchemy-fr/PHP-FFmpeg)
|
|
|
|
|
|
2012-05-11 00:36:57 +02:00
|
|
|
An Object Oriented library to convert video/audio files with AVConv / FFmpeg.
|
2012-04-13 14:16:50 +02:00
|
|
|
|
2012-06-21 11:42:45 +03:00
|
|
|
Check another amazing repo : [PHP FFMpeg extras](https://github.com/alchemy-fr/PHP-FFMpeg-Extras), you will find lots of Audio/Video formats there.
|
|
|
|
|
|
2012-05-31 16:07:30 +02:00
|
|
|
##Documentation
|
|
|
|
|
|
2012-05-31 16:25:42 +02:00
|
|
|
Read The Documentation at [Read The Docs !](http://readthedocs.org/docs/ffmpeg-php/)
|
|
|
|
|
|
|
|
|
|
##API Browser
|
|
|
|
|
|
|
|
|
|
Browse the [API](http://readthedocs.org/docs/ffmpeg-php/en/latest/_static/API/)
|
2012-05-31 16:07:30 +02:00
|
|
|
|
|
|
|
|
##Usage Example
|
|
|
|
|
|
|
|
|
|
```php
|
2012-05-31 16:10:16 +02:00
|
|
|
$x264 = new X264();
|
2012-05-31 16:07:30 +02:00
|
|
|
$x264->setDimensions(320, 240);
|
|
|
|
|
|
|
|
|
|
$ffmpeg->open('Video.mpeg')
|
2012-05-31 16:10:16 +02:00
|
|
|
->encode($new WebM(), 'file.webm')
|
|
|
|
|
->encode($x264, 'file.mp4')
|
|
|
|
|
->encode($new Ogg(), 'file.ogv')
|
2012-05-31 16:07:30 +02:00
|
|
|
->close();
|
|
|
|
|
```
|
|
|
|
|
|
2012-11-25 15:40:20 +01:00
|
|
|
##Getting progress information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
$progressHelper = new FFMpeg\Helper\AudioProgressHelper(function($percent, $remaining, $rate) {
|
|
|
|
|
echo "Current progress: " . $percent "%\n";
|
|
|
|
|
echo "Remaining time: " . $remaining " seconds\n";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$ffmpeg->open('Audio.wav')
|
|
|
|
|
->attachHelper($progressHelper)
|
|
|
|
|
->encode(new Mp3(), 'file.mp3')
|
|
|
|
|
->close();
|
|
|
|
|
```
|
|
|
|
|
|
2012-09-03 14:55:04 +02:00
|
|
|
##Using with Silex Microframework
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
use FFMpeg\SilexServiceProvider;
|
|
|
|
|
use Silex\Application;
|
|
|
|
|
|
|
|
|
|
$app = new Application();
|
|
|
|
|
$app->register(new FFMpegServiceProvider());
|
|
|
|
|
```
|
|
|
|
|
|
2012-05-31 16:07:30 +02:00
|
|
|
##License
|
|
|
|
|
|
|
|
|
|
This project is licensed under the [MIT license](http://opensource.org/licenses/MIT).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|