Apply frame filters on Frame::save
This commit is contained in:
parent
5814eb3085
commit
bcf3e5f65a
3 changed files with 10 additions and 5 deletions
|
|
@ -13,9 +13,8 @@ namespace FFMpeg\Filters\Frame;
|
|||
|
||||
use FFMpeg\Filters\FilterInterface;
|
||||
use FFMpeg\Media\Frame;
|
||||
use FFMpeg\Format\FrameInterface;
|
||||
|
||||
interface FrameFilterInterface extends FilterInterface
|
||||
{
|
||||
public function apply(Frame $frame, FrameInterface $format);
|
||||
public function apply(Frame $frame);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,16 +97,22 @@ class Frame extends AbstractMediaType
|
|||
'-y', '-ss', (string) $this->timecode,
|
||||
'-i', $this->pathfile,
|
||||
'-vframes', '1',
|
||||
'-f', 'image2', $pathfile
|
||||
'-f', 'image2'
|
||||
);
|
||||
} else {
|
||||
$commands = array(
|
||||
'-y', '-i', $this->pathfile,
|
||||
'-vframes', '1', '-ss', (string) $this->timecode,
|
||||
'-f', 'image2', $pathfile
|
||||
'-f', 'image2'
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->filters as $filter) {
|
||||
$commands = array_merge($commands, $filter->apply($this));
|
||||
}
|
||||
|
||||
$commands = array_merge($commands, array($pathfile));
|
||||
|
||||
try {
|
||||
$this->driver->command($commands);
|
||||
} catch (ExecutionFailureException $e) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class FrameTest extends AbstractMediaTestCase
|
|||
*/
|
||||
public function testWithInvalidFile()
|
||||
{
|
||||
new Frame('/No/file', $this->getFFMpegDriverMock(), $this->getFFProbeMock(), $this->getTimeCodeMock());
|
||||
new Frame($this->getVideoMock('/No/file'), $this->getFFMpegDriverMock(), $this->getFFProbeMock(), $this->getTimeCodeMock());
|
||||
}
|
||||
|
||||
public function testGetTimeCode()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue