2012-04-13 10:20:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
2012-04-13 14:34:53 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of PHP-FFmpeg.
|
|
|
|
|
*
|
|
|
|
|
* (c) Alchemy <info@alchemy.fr>
|
|
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-04-13 12:45:41 +02:00
|
|
|
namespace FFMpeg\Format\Video;
|
2012-04-13 10:20:54 +02:00
|
|
|
|
2012-04-13 15:42:10 +02:00
|
|
|
/**
|
|
|
|
|
* The X264 video format
|
|
|
|
|
*/
|
2012-05-25 20:53:56 +02:00
|
|
|
class X264 extends DefaultVideo
|
2012-04-13 10:20:54 +02:00
|
|
|
{
|
2021-03-02 15:39:45 +01:00
|
|
|
/** @var bool */
|
2014-08-12 20:51:22 +02:00
|
|
|
private $bframesSupport = true;
|
2014-08-01 00:03:13 +08:00
|
|
|
|
2021-03-02 15:39:45 +01:00
|
|
|
/** @var int */
|
2016-11-10 12:19:17 -03:00
|
|
|
private $passes = 2;
|
|
|
|
|
|
2021-03-03 00:24:00 +03:30
|
|
|
public function __construct($audioCodec = 'aac', $videoCodec = 'libx264')
|
2013-06-25 10:03:20 +02:00
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->setAudioCodec($audioCodec)
|
|
|
|
|
->setVideoCodec($videoCodec);
|
|
|
|
|
}
|
2012-04-13 10:20:54 +02:00
|
|
|
|
2012-06-11 19:19:03 +02:00
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public function supportBFrames()
|
|
|
|
|
{
|
2014-08-01 00:03:13 +08:00
|
|
|
return $this->bframesSupport;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param $support
|
2014-08-12 20:51:22 +02:00
|
|
|
*
|
2014-08-01 00:03:13 +08:00
|
|
|
* @return X264
|
|
|
|
|
*/
|
|
|
|
|
public function setBFramesSupport($support)
|
|
|
|
|
{
|
|
|
|
|
$this->bframesSupport = $support;
|
|
|
|
|
|
|
|
|
|
return $this;
|
2012-06-11 19:19:03 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-13 15:42:10 +02:00
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getAvailableAudioCodecs()
|
2012-04-13 10:20:54 +02:00
|
|
|
{
|
2019-04-27 13:22:12 -05:00
|
|
|
return array('copy', 'aac', 'libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac');
|
2012-04-13 10:20:54 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-13 15:42:10 +02:00
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getAvailableVideoCodecs()
|
2012-04-13 10:20:54 +02:00
|
|
|
{
|
|
|
|
|
return array('libx264');
|
|
|
|
|
}
|
2012-10-31 00:30:24 +01:00
|
|
|
|
2016-11-10 12:19:17 -03:00
|
|
|
/**
|
|
|
|
|
* @param $passes
|
|
|
|
|
*
|
|
|
|
|
* @return X264
|
|
|
|
|
*/
|
|
|
|
|
public function setPasses($passes)
|
|
|
|
|
{
|
|
|
|
|
$this->passes = $passes;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-31 00:30:24 +01:00
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getPasses()
|
|
|
|
|
{
|
2021-03-04 19:17:34 +01:00
|
|
|
return $this->getKiloBitrate() === 0 ? 1 : $this->passes;
|
2012-10-31 00:30:24 +01:00
|
|
|
}
|
2013-04-16 11:24:29 -07:00
|
|
|
|
2014-08-12 20:51:22 +02:00
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
2013-04-16 11:24:29 -07:00
|
|
|
public function getModulus()
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
2012-05-25 15:44:43 +02:00
|
|
|
}
|