Merge pull request #588 from PHP-FFMpeg/jens1o-patch-1

Document the `setFrameFileType` function
This commit is contained in:
Jens Hausdorf 2018-10-04 15:51:44 +02:00 committed by GitHub
commit 178247c1db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
# PHP FFmpeg
# php-ffmpeg
[![Build Status](https://secure.travis-ci.org/PHP-FFMpeg/PHP-FFMpeg.png?branch=master)](http://travis-ci.org/PHP-FFMpeg/PHP-FFMpeg)
@ -144,7 +144,7 @@ $frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(42));
$frame->save('image.jpg');
```
If you want to extract multiple images from your video, you can use the following filter:
If you want to extract multiple images from the video, you can use the following filter:
```php
$video
@ -155,6 +155,16 @@ $video
$video
->save(new FFMpeg\Format\Video\X264(), '/path/to/new/file');
```
By default, this will save the frames as `jpg` images.
You are able to override this using `setFrameFileType` to save the frames in another format:
```php
$frameFileType = 'jpg'; // either 'jpg', 'jpeg' or 'png'
$filter = new ExtractMultipleFramesFilter($frameRate, $destinationFolder);
$filter->setFrameFileType($frameFileType);
$video->addFilter($filter);
```
##### Clip