allow to set frame file type instead of hardcoded jpg
This commit is contained in:
parent
a1d5fa51ba
commit
ae92dd5887
2 changed files with 14 additions and 8 deletions
|
|
@ -35,6 +35,7 @@ class ExtractMultipleFramesFilter implements VideoFilterInterface
|
|||
private $priority;
|
||||
private $frameRate;
|
||||
private $destinationFolder;
|
||||
private $frameFileType = 'jpg';
|
||||
|
||||
public function __construct($frameRate = self::FRAMERATE_EVERY_SEC, $destinationFolder = __DIR__, $priority = 0)
|
||||
{
|
||||
|
|
@ -49,6 +50,10 @@ class ExtractMultipleFramesFilter implements VideoFilterInterface
|
|||
$this->destinationFolder = $destinationFolder;
|
||||
}
|
||||
|
||||
public function setFrameFileType($frameFileType) {
|
||||
$this->frameFileType = $frameFileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -117,7 +122,7 @@ class ExtractMultipleFramesFilter implements VideoFilterInterface
|
|||
// Set the parameters
|
||||
$commands[] = '-vf';
|
||||
$commands[] = 'fps=' . $this->frameRate;
|
||||
$commands[] = $this->destinationFolder . 'frame-%'.$nbDigitsInFileNames.'d.jpg';
|
||||
$commands[] = $this->destinationFolder . 'frame-%'.$nbDigitsInFileNames.'d.' . $this->frameFileType;
|
||||
}
|
||||
catch (RuntimeException $e) {
|
||||
throw new RuntimeException('An error occured while extracting the frames: ' . $e->getMessage() . '. The code: ' . $e->getCode());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue