@@ -13,7 +13,7 @@ This package provides an integration with FFmpeg for Laravel 5.1 and higher. The
1313You can install the package via composer:
1414
1515``` bash
16- composer require pbmedia/laravel-ffmpeg dev-master
16+ composer require pbmedia/laravel-ffmpeg
1717```
1818
1919Add the service provider and facade to your ``` app.php ``` config file:
@@ -65,6 +65,33 @@ FFMpeg::fromDisk('videos')
6565 ->save('FrameAt10sec.png');
6666```
6767
68+ You can add filters through a ``` Closure ``` or by using PHP-FFMpeg's Filter objects:
69+
70+ ``` php
71+ FFMpeg::fromDisk('videos')
72+ ->open('steve_howe.mp4')
73+ ->addFilter(function ($filters) {
74+ $filters->resize(new \FFMpeg\Coordinate\Dimension(640, 480));
75+ })
76+ ->export()
77+ ->toDisk('converted_videos')
78+ ->inFormat(new \FFMpeg\Format\Video\X264)
79+ ->save('small_steve.mkv');
80+
81+ // or
82+
83+ $start = \FFMpeg\Coordinate\TimeCode::fromSeconds(5)
84+ $clipFilter = new \FFMpeg\Filters\Video\ClipFilter($start);
85+
86+ FFMpeg::fromDisk('videos')
87+ ->open('steve_howe.mp4')
88+ ->addFilter($clipFilter)
89+ ->export()
90+ ->toDisk('converted_videos')
91+ ->inFormat(new \FFMpeg\Format\Video\X264)
92+ ->save('short_steve.mkv');
93+ ```
94+
6895Chain multiple convertions:
6996
7097``` php
@@ -77,19 +104,16 @@ FFMpeg::open('my_movie.mov')
77104 // export to FTP, converted in WMV
78105 ->export()
79106 ->toDisk('ftp')
80- ->inFormat(new FFMpeg\Format\Video\WMV)
107+ ->inFormat(new \ FFMpeg\Format\Video\WMV)
81108 ->save('my_movie.wmv')
82109
83110 // export to Amazon S3, converted in X264
84111 ->export()
85112 ->toDisk('s3')
86- ->inFormat(new FFMpeg\Format\Video\X264)
113+ ->inFormat(new \ FFMpeg\Format\Video\X264)
87114 ->save('my_movie.mkv');
88115```
89116
90- ## To do
91- * Writing test for exporting frames
92-
93117## Changelog
94118
95119Please see [ CHANGELOG] ( CHANGELOG.md ) for more information what has changed recently.
0 commit comments