From 18845d406e1d4839886b2e010ff51a1c7bc97480 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 12:43:40 -0300 Subject: [PATCH] We add a missing parameter to the ffmpeg command --- src/FFMpeg/Media/Video.php | 6 ++++-- src/FFMpeg/Media/Waveform.php | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/FFMpeg/Media/Video.php b/src/FFMpeg/Media/Video.php index 3338b51..d6852a2 100644 --- a/src/FFMpeg/Media/Video.php +++ b/src/FFMpeg/Media/Video.php @@ -185,10 +185,12 @@ class Video extends Audio /** * Gets the waveform of the video. * + * @param integer $width + * @param integer $height * @return Waveform */ - public function waveform() + public function waveform($width = 640, $height = 120) { - return new Waveform($this, $this->driver, $this->ffprobe); + return new Waveform($this, $this->driver, $this->ffprobe, $width, $height); } } diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index 8adf2be..062d006 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -23,11 +23,15 @@ class Waveform extends AbstractMediaType { /** @var Video */ private $video; + private $width; + private $height; - public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe) + public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) { parent::__construct($video->getPathfile(), $driver, $ffprobe); $this->video = $video; + $this->width = $width; + $this->height = $height; } /** @@ -79,6 +83,7 @@ class Waveform extends AbstractMediaType */ $commands = array( '-i', 'input', '-filter_complex', + 'showwavespic=s='.$this->width.'x'.$this->height, '-frames:v', '1', $this->pathfile );