-
Notifications
You must be signed in to change notification settings - Fork 874
/
Clip.php
62 lines (51 loc) · 1.32 KB
/
Clip.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace FFMpeg\Media;
use FFMpeg\Driver\FFMpegDriver;
use FFMpeg\FFProbe;
use FFMpeg\Coordinate\TimeCode;
use FFMpeg\Format\FormatInterface;
/**
* Video clip.
*
* Use input seeking, see http://trac.ffmpeg.org/wiki/Seeking
*/
class Clip extends Video
{
/** @var TimeCode Start time */
private $start;
/** @var TimeCode Duration */
private $duration;
/** @var Video Parrent video */
private $video;
public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe, TimeCode $start, TimeCode $duration = null)
{
$this->start = $start;
$this->duration = $duration;
$this->video = $video;
parent::__construct($video->getPathfile(), $driver, $ffprobe);
}
/**
* Returns the video related to the frame.
*
* @param FormatInterface $format
* @return Video
*/
public function getVideo()
{
return $this->video;
}
/**
* Return base part of command.
*
* @return array
*/
protected function basePartOfCommand(FormatInterface $format)
{
$arr = array('-y', '-ss', (string) $this->start, '-i', $this->pathfile);
if (is_null($this->duration) === false) {
$arr[] = '-t';
$arr[] = (string) $this->duration;
}
return $arr;
}
}