Esempio n. 1
0
 /**
  * Get Size.
  *
  * @return string
  */
 public function getSize()
 {
     $stream = $this->video->getStreams()->first();
     $dim = null;
     if ($stream->isVideo()) {
         $dim = $stream->getDimensions()->getWidth() . 'x' . $stream->getDimensions()->getHeight();
     }
     return $dim;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function apply(Video $video, VideoInterface $format)
 {
     foreach ($video->getStreams()->videos() as $stream) {
         if ($stream->has('width') && $stream->has('height')) {
             $stream->set('width', $this->dimension->getWidth());
             $stream->set('height', $this->dimension->getHeight());
         }
     }
     return array('-filter:v', 'crop=' . $this->dimension->getWidth() . ':' . $this->dimension->getHeight() . ':' . $this->point->getX() . ':' . $this->point->getY());
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function apply(Video $video, VideoInterface $format)
 {
     if (in_array($this->angle, array(self::ROTATE_90, self::ROTATE_270), true)) {
         foreach ($video->getStreams()->videos() as $stream) {
             if ($stream->has('width') && $stream->has('height')) {
                 $width = $stream->get('width');
                 $stream->set('width', $stream->get('height'));
                 $stream->set('height', $width);
             }
         }
     }
     return array('-vf', $this->angle, '-metadata:s:v:0', 'rotate=0');
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function apply(Video $video, VideoInterface $format)
 {
     $dimensions = null;
     $commands = array();
     foreach ($video->getStreams() as $stream) {
         if ($stream->isVideo()) {
             try {
                 $dimensions = $stream->getDimensions();
                 break;
             } catch (RuntimeException $e) {
             }
         }
     }
     if (null !== $dimensions) {
         $dimensions = $this->getComputedDimensions($dimensions, $format->getModulus());
         $commands[] = '-s';
         $commands[] = $dimensions->getWidth() . 'x' . $dimensions->getHeight();
     }
     return $commands;
 }