scratch – Blame information for rev 120

Subversion Repositories:
Rev:
Rev Author Line No. Line
120 office 1 <?php
2  
3 /*
4 * This file is part of PHP-FFmpeg.
5 *
6 * (c) Alchemy <dev.team@alchemy.fr>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11  
12 namespace FFMpeg\Filters\Video;
13  
14 use FFMpeg\Coordinate\FrameRate;
15 use FFMpeg\Media\Video;
16 use FFMpeg\Format\VideoInterface;
17  
18 class FrameRateFilter implements VideoFilterInterface
19 {
20 private $rate;
21 private $gop;
22 private $priority;
23  
24 public function __construct(FrameRate $rate, $gop, $priority = 0)
25 {
26 $this->rate = $rate;
27 $this->gop = $gop;
28 $this->priority = $priority;
29 }
30  
31 /**
32 * {@inheritdoc}
33 */
34 public function getPriority()
35 {
36 return $this->priority;
37 }
38  
39 /**
40 * Returns the frame rate.
41 *
42 * @return FrameRate
43 */
44 public function getFrameRate()
45 {
46 return $this->rate;
47 }
48  
49 /**
50 * Returns the GOP size.
51 *
52 * @see https://wikipedia.org/wiki/Group_of_pictures
53 *
54 * @return Integer
55 */
56 public function getGOP()
57 {
58 return $this->gop;
59 }
60  
61 /**
62 * {@inheritdoc}
63 */
64 public function apply(Video $video, VideoInterface $format)
65 {
66 $commands = array('-r', $this->rate->getValue());
67  
68 /**
69 * @see http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
70 */
71 if ($format->supportBFrames()) {
72 $commands[] = '-b_strategy';
73 $commands[] = '1';
74 $commands[] = '-bf';
75 $commands[] = '3';
76 $commands[] = '-g';
77 $commands[] = $this->gop;
78 }
79  
80 return $commands;
81 }
82 }