add crop filter
This commit is contained in:
parent
c8949fe3df
commit
1d462b9eb3
1 changed files with 53 additions and 0 deletions
53
src/FFMpeg/Filters/Video/CropFilter.php
Normal file
53
src/FFMpeg/Filters/Video/CropFilter.php
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is part of PHP-FFmpeg.
|
||||||
|
*
|
||||||
|
* (c) Alchemy <dev.team@alchemy.fr>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FFMpeg\Filters\Video;
|
||||||
|
|
||||||
|
use FFMpeg\Coordinate\Dimension;
|
||||||
|
use FFMpeg\Coordinate\Point;
|
||||||
|
use FFMpeg\Format\VideoInterface;
|
||||||
|
use FFMpeg\Media\Video;
|
||||||
|
|
||||||
|
class CropFilter implements VideoFilterInterface
|
||||||
|
{
|
||||||
|
/** @var integer */
|
||||||
|
protected $priority;
|
||||||
|
/** @var Dimension */
|
||||||
|
protected $dimension;
|
||||||
|
/** @var Point */
|
||||||
|
protected $point;
|
||||||
|
|
||||||
|
public function __construct(Point $point, Dimension $dimension, $priority = 0)
|
||||||
|
{
|
||||||
|
$this->priority = $priority;
|
||||||
|
$this->dimension = $dimension;
|
||||||
|
$this->point = $point;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getPriority()
|
||||||
|
{
|
||||||
|
return $this->priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function apply(Video $video, VideoInterface $format)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'-filter:v',
|
||||||
|
'crop=' .
|
||||||
|
$this->dimension->getWidth() .':' . $this->dimension->getHeight() . ':' . $this->point->getX() . ':' . $this->point->getY()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue