Added ffmpeg version checking in the ComplexMediaTest::testXStackFilter().

This commit is contained in:
CaliforniaMountainSnake 2020-02-20 14:34:21 +03:00
commit 6dc260fd3d
3 changed files with 21 additions and 0 deletions

View file

@ -12,6 +12,7 @@ use FFMpeg\Media\ComplexMedia;
*/
class XStackFilter extends AbstractComplexFilter
{
const MINIMAL_FFMPEG_VERSION = '4.1';
const LAYOUT_2X2 = '0_0|0_h0|w0_0|w0_h0';
const LAYOUT_1X4 = '0_0|0_h0|0_h0+h1|0_h0+h1+h2';
const LAYOUT_3X3 = '0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1';

View file

@ -156,6 +156,14 @@ class ComplexMediaTest extends FunctionalTestCase
public function testXStackFilter()
{
$ffmpeg = $this->getFFMpeg();
$ffmpegVersion = $this->getFFMpegVersion();
if (version_compare($ffmpegVersion, XStackFilter::MINIMAL_FFMPEG_VERSION) === -1) {
$this->markTestSkipped('XStack filter is supported starting from '
. XStackFilter::MINIMAL_FFMPEG_VERSION . ' ffmpeg version, your version is '
. $ffmpegVersion);
return;
}
$inputs = array(realpath(__DIR__ . '/../files/Test.ogv'));
$format = new X264('aac', 'libx264');
$output = __DIR__ . '/output/' . self::PATH_PREFIX . 'xstack_test.mp4';

View file

@ -14,4 +14,16 @@ abstract class FunctionalTestCase extends TestCase
{
return FFMpeg::create(array('timeout' => 300));
}
/**
* Get ffmpeg version.
*
* @return string
*/
public function getFFMpegVersion()
{
preg_match('#version\s(\S+)#',
$this->getFFMpeg()->getFFMpegDriver()->command('-version'), $version);
return $version[1];
}
}