Remove mandatory dimensions
This commit is contained in:
parent
ecccc1c9f5
commit
06c6aabd9d
8 changed files with 36 additions and 60 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,5 +2,4 @@
|
|||
/vendor/
|
||||
/docs/build
|
||||
composer.phar
|
||||
composer.lock
|
||||
|
||||
|
|
|
|||
|
|
@ -193,8 +193,13 @@ class FFMpeg extends Binary
|
|||
. escapeshellarg($this->pathfile) . ' '
|
||||
. $format->getExtraParams() . ' ';
|
||||
|
||||
$cmd_part2 = ' -s ' . $format->getWidth() . 'x' . $format->getHeight()
|
||||
. ' -r ' . $format->getFrameRate()
|
||||
$cmd_part2 = '';
|
||||
|
||||
if ($format->getWidth() && $format->getHieght()) {
|
||||
$cmd_part2 .= ' -s ' . $format->getWidth() . 'x' . $format->getHeight();
|
||||
}
|
||||
|
||||
$cmd_part2 .= ' -r ' . $format->getFrameRate()
|
||||
. ' -vcodec ' . $format->getVideoCodec()
|
||||
. ' -b ' . $format->getKiloBitrate() . 'k -g 25 -bf 3'
|
||||
. ' -threads ' . $threads
|
||||
|
|
|
|||
|
|
@ -27,17 +27,6 @@ abstract class DefaultVideoFormat extends DefaultAudioFormat implements VideoFor
|
|||
protected $GOPsize = 25;
|
||||
protected $kiloBitrate = 1000;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param integer $width
|
||||
* @param integer $height The height of the video format
|
||||
*/
|
||||
public function __construct($width, $height)
|
||||
{
|
||||
$this->setDimensions($width, $height);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Monolog\Handler\NullHandler;
|
|||
|
||||
class FFMpegTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var FFMpeg
|
||||
*/
|
||||
|
|
@ -105,7 +104,9 @@ class FFMpegTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testEncode()
|
||||
{
|
||||
$this->object->encode(new Format\Video\WebM(32, 32), './invalid.file');
|
||||
$format = new Format\Video\WebM();
|
||||
$format-> setDimensions(32, 32);
|
||||
$this->object->encode($format, './invalid.file');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -119,7 +120,11 @@ class FFMpegTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$ffmpeg = new FFMpeg('wrongbinary', $logger);
|
||||
$ffmpeg->open(__DIR__ . '/../../files/Test.ogv');
|
||||
$ffmpeg->encode(new Format\Video\WebM(32, 32), './invalid.file');
|
||||
|
||||
$format = new Format\Video\WebM();
|
||||
$format-> setDimensions(32, 32);
|
||||
|
||||
$ffmpeg->encode($format, './invalid.file');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -162,8 +167,11 @@ class FFMpegTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$dest = __DIR__ . '/../../files/encode_test.webm';
|
||||
|
||||
$format = new Format\Video\WebM();
|
||||
$format-> setDimensions(32, 32);
|
||||
|
||||
$this->object->open(__DIR__ . '/../../files/Test.ogv');
|
||||
$this->object->encode(new Format\Video\WebM(32, 32), $dest);
|
||||
$this->object->encode($format, $dest);
|
||||
|
||||
$this->probe->probeFormat($dest);
|
||||
|
||||
|
|
@ -178,8 +186,11 @@ class FFMpegTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$dest = __DIR__ . '/../../files/encode_test.ogv';
|
||||
|
||||
$format = new Format\Video\Ogg();
|
||||
$format->setDimensions(32, 32);
|
||||
|
||||
$this->object->open(__DIR__ . '/../../files/Test.ogv');
|
||||
$this->object->encode(new Format\Video\Ogg(32, 32), $dest);
|
||||
$this->object->encode($format, $dest);
|
||||
|
||||
$this->probe->probeFormat($dest);
|
||||
|
||||
|
|
@ -194,12 +205,14 @@ class FFMpegTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$dest = __DIR__ . '/../../files/encode_test.mp4';
|
||||
|
||||
$format = new Format\Video\WebM();
|
||||
$format-> setDimensions(32, 32);
|
||||
|
||||
$this->object->open(__DIR__ . '/../../files/Test.ogv');
|
||||
$this->object->encode(new Format\Video\X264(32, 32), $dest);
|
||||
$this->object->encode($format, $dest);
|
||||
|
||||
$this->probe->probeFormat($dest);
|
||||
|
||||
unlink($dest);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,22 +12,13 @@ class DefaultVideoFormatTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new DefaultVideoFormatTester(320, 240);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::__construct
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::getWidth
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::getHeight
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$this->assertEquals(320, $this->object->getWidth());
|
||||
$this->assertEquals(240, $this->object->getHeight());
|
||||
$this->object = new DefaultVideoFormatTester();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::setDimensions
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::getWidth
|
||||
* @covers FFMpeg\Format\DefaultVideoFormat::getHeight
|
||||
*/
|
||||
public function testSetDimensions()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,15 +12,8 @@ class OggTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new Ogg(320, 320);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FFMpeg\Format\Video\Ogg::__construct
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$this->assertInstanceOf('\\FFMpeg\\Format\\DefaultVideoFormat', $this->object);
|
||||
$this->object = new Ogg();
|
||||
$this->object->setDimensions(320, 320);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class WebMTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new WebM(320, 320);
|
||||
$this->object = new WebM();
|
||||
$this->object->setDimensions(320, 320);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,12 +40,4 @@ class WebMTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue(is_scalar($this->object->getExtraParams()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FFMpeg\Format\Video\WebM::__construct
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$this->assertInstanceOf('\\FFMpeg\\Format\\DefaultVideoFormat', $this->object);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,8 @@ class X264Test extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new X264(320, 320);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FFMpeg\Format\Video\X264::__construct
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$this->assertInstanceOf('\\FFMpeg\\Format\\DefaultVideoFormat', $this->object);
|
||||
$this->object = new X264();
|
||||
$this->object->setDimensions(320, 320);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue