Add ability to disable -b:v (#767)

* 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>
This commit is contained in:
Ilya Chekalsky 2021-03-04 19:17:34 +01:00 committed by GitHub
commit afffd627ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 12 deletions

View file

@ -54,7 +54,7 @@ abstract class DefaultVideo extends DefaultAudio implements VideoInterface
*/
public function setKiloBitrate($kiloBitrate)
{
if ($kiloBitrate < 1) {
if ($kiloBitrate < 0) {
throw new InvalidArgumentException('Wrong kiloBitrate value');
}

View file

@ -81,7 +81,7 @@ class X264 extends DefaultVideo
*/
public function getPasses()
{
return $this->passes;
return $this->getKiloBitrate() === 0 ? 1 : $this->passes;
}
/**

View file

@ -162,8 +162,11 @@ abstract class AbstractVideo extends Audio
}
if ($format instanceof VideoInterface) {
$commands[] = '-b:v';
$commands[] = $format->getKiloBitrate() . 'k';
if ($format->getKiloBitrate() !== 0) {
$commands[] = '-b:v';
$commands[] = $format->getKiloBitrate() . 'k';
}
$commands[] = '-refs';
$commands[] = '6';
$commands[] = '-coder';