* adds ability to disable -b:v * Fixed a bug in the way the paths to the test files were defined in the AudioConcatenationTest.php file * Added a test to make sure that a negative kilobit rate returns an exception * Added a test to check that the -b:v options are not set if the kilo bitrate is set to 0 * Disable 2pass when -b:v is disabled Co-Authored-By: Philipp Doblhofer <6283313+philipp-doblhofer@users.noreply.github.com> * Changed the way we call the class FFMpeg\Exception\InvalidArgumentException in tests * Changed the way we call the class FFMpeg\Exception\InvalidArgumentException in tests * Updated the README to include this new option Co-authored-by: Romain Biard <romain.biard@gmail.com> Co-authored-by: Philipp Doblhofer <6283313+philipp-doblhofer@users.noreply.github.com>
94 lines
1.6 KiB
PHP
94 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
|
|
namespace FFMpeg\Format\Video;
|
|
|
|
/**
|
|
* The X264 video format
|
|
*/
|
|
class X264 extends DefaultVideo
|
|
{
|
|
/** @var bool */
|
|
private $bframesSupport = true;
|
|
|
|
/** @var int */
|
|
private $passes = 2;
|
|
|
|
public function __construct($audioCodec = 'aac', $videoCodec = 'libx264')
|
|
{
|
|
$this
|
|
->setAudioCodec($audioCodec)
|
|
->setVideoCodec($videoCodec);
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function supportBFrames()
|
|
{
|
|
return $this->bframesSupport;
|
|
}
|
|
|
|
/**
|
|
* @param $support
|
|
*
|
|
* @return X264
|
|
*/
|
|
public function setBFramesSupport($support)
|
|
{
|
|
$this->bframesSupport = $support;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getAvailableAudioCodecs()
|
|
{
|
|
return array('copy', 'aac', 'libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac');
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getAvailableVideoCodecs()
|
|
{
|
|
return array('libx264');
|
|
}
|
|
|
|
/**
|
|
* @param $passes
|
|
*
|
|
* @return X264
|
|
*/
|
|
public function setPasses($passes)
|
|
{
|
|
$this->passes = $passes;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getPasses()
|
|
{
|
|
return $this->getKiloBitrate() === 0 ? 1 : $this->passes;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getModulus()
|
|
{
|
|
return 2;
|
|
}
|
|
}
|