scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 114  →  ?path2? @ 115
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/Aac.php
@@ -0,0 +1,31 @@
<?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\Audio;
 
/**
* The AAC audio format
*/
class Aac extends DefaultAudio
{
public function __construct()
{
$this->audioCodec = 'libfdk_aac';
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('libfdk_aac');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/DefaultAudio.php
@@ -0,0 +1,142 @@
<?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\Audio;
 
use Evenement\EventEmitter;
use FFMpeg\Exception\InvalidArgumentException;
use FFMpeg\Format\AudioInterface;
use FFMpeg\Media\MediaTypeInterface;
use FFMpeg\Format\ProgressableInterface;
use FFMpeg\Format\ProgressListener\AudioProgressListener;
use FFMpeg\FFProbe;
 
abstract class DefaultAudio extends EventEmitter implements AudioInterface, ProgressableInterface
{
/** @var string */
protected $audioCodec;
 
/** @var integer */
protected $audioKiloBitrate = 128;
 
/** @var integer */
protected $audioChannels = null;
 
/**
* {@inheritdoc}
*/
public function getExtraParams()
{
return array();
}
 
/**
* {@inheritdoc}
*/
public function getAudioCodec()
{
return $this->audioCodec;
}
 
/**
* Sets the audio codec, Should be in the available ones, otherwise an
* exception is thrown.
*
* @param string $audioCodec
*
* @throws InvalidArgumentException
*/
public function setAudioCodec($audioCodec)
{
if ( ! in_array($audioCodec, $this->getAvailableAudioCodecs())) {
throw new InvalidArgumentException(sprintf(
'Wrong audiocodec value for %s, available formats are %s'
, $audioCodec, implode(', ', $this->getAvailableAudioCodecs())
));
}
 
$this->audioCodec = $audioCodec;
 
return $this;
}
 
/**
* {@inheritdoc}
*/
public function getAudioKiloBitrate()
{
return $this->audioKiloBitrate;
}
 
/**
* Sets the kiloBitrate value.
*
* @param integer $kiloBitrate
* @throws InvalidArgumentException
*/
public function setAudioKiloBitrate($kiloBitrate)
{
if ($kiloBitrate < 1) {
throw new InvalidArgumentException('Wrong kiloBitrate value');
}
 
$this->audioKiloBitrate = (int) $kiloBitrate;
 
return $this;
}
 
/**
* {@inheritdoc}
*/
public function getAudioChannels()
{
return $this->audioChannels;
}
 
/**
* Sets the channels value.
*
* @param integer $channels
* @throws InvalidArgumentException
*/
public function setAudioChannels($channels)
{
if ($channels < 1) {
throw new InvalidArgumentException('Wrong channels value');
}
 
$this->audioChannels = (int) $channels;
 
return $this;
}
 
/**
* {@inheritdoc}
*/
public function createProgressListener(MediaTypeInterface $media, FFProbe $ffprobe, $pass, $total)
{
$format = $this;
$listener = new AudioProgressListener($ffprobe, $media->getPathfile(), $pass, $total);
$listener->on('progress', function () use ($media, $format) {
$format->emit('progress', array_merge(array($media, $format), func_get_args()));
});
 
return array($listener);
}
 
/**
* {@inheritDoc}
*/
public function getPasses()
{
return 1;
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/Flac.php
@@ -0,0 +1,31 @@
<?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\Audio;
 
/**
* The Flac audio format
*/
class Flac extends DefaultAudio
{
public function __construct()
{
$this->audioCodec = 'flac';
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('flac');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/Mp3.php
@@ -0,0 +1,31 @@
<?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\Audio;
 
/**
* The MP3 audio format
*/
class Mp3 extends DefaultAudio
{
public function __construct()
{
$this->audioCodec = 'libmp3lame';
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('libmp3lame');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/Vorbis.php
@@ -0,0 +1,39 @@
<?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\Audio;
 
/**
* The Vorbis audio format
*/
class Vorbis extends DefaultAudio
{
public function __construct()
{
$this->audioCodec = 'vorbis';
}
 
/**
* {@inheritdoc}
*/
public function getExtraParams()
{
return array('-strict', '-2');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('vorbis');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Audio/Wav.php
@@ -0,0 +1,31 @@
<?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\Audio;
 
/**
* The WAV audio format
*/
class Wav extends DefaultAudio
{
public function __construct()
{
$this->audioCodec = 'pcm_s16le';
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('pcm_s16le');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/AudioInterface.php
@@ -0,0 +1,42 @@
<?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;
 
interface AudioInterface extends FormatInterface
{
/**
* Gets the audio kiloBitrate value.
*
* @return integer
*/
public function getAudioKiloBitrate();
 
/**
* Gets the audio channels value.
*
* @return integer
*/
public function getAudioChannels();
 
/**
* Returns the audio codec.
*
* @return string
*/
public function getAudioCodec();
 
/**
* Returns the list of available audio codecs for this format.
*
* @return array
*/
public function getAvailableAudioCodecs();
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/FormatInterface.php
@@ -0,0 +1,28 @@
<?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;
 
interface FormatInterface
{
/**
* Returns the number of passes.
*
* @return string
*/
public function getPasses();
 
/**
* Returns an array of extra parameters to add to ffmpeg commandline.
*
* @return array()
*/
public function getExtraParams();
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/FrameInterface.php
@@ -0,0 +1,16 @@
<?php
 
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <dev.team@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
 
namespace FFMpeg\Format;
 
interface FrameInterface extends FormatInterface
{
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/ProgressListener/AbstractProgressListener.php
@@ -0,0 +1,262 @@
<?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\ProgressListener;
 
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use Evenement\EventEmitter;
use FFMpeg\FFProbe;
use FFMpeg\Exception\RuntimeException;
 
/**
* @author Robert Gruendler <r.gruendler@gmail.com>
*/
abstract class AbstractProgressListener extends EventEmitter implements ListenerInterface
{
/** @var integer */
private $duration;
 
/** @var integer */
private $totalSize;
 
/** @var integer */
private $currentSize;
 
/** @var integer */
private $currentTime;
 
/** @var double */
private $lastOutput = null;
 
/** @var FFProbe */
private $ffprobe;
 
/** @var string */
private $pathfile;
 
/** @var Boolean */
private $initialized = false;
 
/** @var integer */
private $currentPass;
 
/** @var integer */
private $totalPass;
 
/**
* Transcoding rate in kb/s
*
* @var integer
*/
private $rate;
 
/**
* Percentage of transcoding progress (0 - 100)
*
* @var integer
*/
private $percent = 0;
 
/**
* Time remaining (seconds)
*
* @var integer
*/
private $remaining = null;
 
/**
* @param FFProbe $ffprobe
* @param string $pathfile
* @param integer $currentPass The cureent pass number
* @param integer $totalPass The total number of passes
*
* @throws RuntimeException
*/
public function __construct(FFProbe $ffprobe, $pathfile, $currentPass, $totalPass)
{
$this->ffprobe = $ffprobe;
$this->pathfile = $pathfile;
$this->currentPass = $currentPass;
$this->totalPass = $totalPass;
}
 
/**
* @return FFProbe
*/
public function getFFProbe()
{
return $this->ffprobe;
}
 
/**
* @return string
*/
public function getPathfile()
{
return $this->pathfile;
}
 
/**
* @return integer
*/
public function getCurrentPass()
{
return $this->currentPass;
}
 
/**
* @return integer
*/
public function getTotalPass()
{
return $this->totalPass;
}
 
/**
* @return int
*/
public function getCurrentTime()
{
return $this->currentTime;
}
 
/**
* {@inheritdoc}
*/
public function handle($type, $data)
{
if (null !== $progress = $this->parseProgress($data)) {
$this->emit('progress', array_values($progress));
}
}
 
/**
* {@inheritdoc}
*/
public function forwardedEvents()
{
return array();
}
 
/**
* Get the regex pattern to match a ffmpeg stderr status line
*/
abstract protected function getPattern();
 
/**
* @param string $progress A ffmpeg stderr progress output
*
* @return array the progressinfo array or null if there's no progress available yet.
*/
private function parseProgress($progress)
{
if (!$this->initialized) {
$this->initialize();
}
 
if (null === $this->totalSize || null === $this->duration) {
return;
}
 
$matches = array();
 
if (preg_match($this->getPattern(), $progress, $matches) !== 1) {
return null;
}
 
$currentDuration = $this->convertDuration($matches[2]);
$currentTime = microtime(true);
$currentSize = trim(str_replace('kb', '', strtolower(($matches[1]))));
$percent = max(0, min(1, $currentDuration / $this->duration));
 
if ($this->lastOutput !== null) {
$delta = $currentTime - $this->lastOutput;
 
// Check the type of the currentSize variable and convert it to an integer if needed.
if(!is_numeric($currentSize)) {
$currentSize = (int)$currentSize;
}
 
$deltaSize = $currentSize - $this->currentSize;
$rate = $deltaSize * $delta;
if ($rate > 0) {
$totalDuration = $this->totalSize / $rate;
$this->remaining = floor($totalDuration - ($totalDuration * $percent));
$this->rate = floor($rate);
} else {
$this->remaining = 0;
$this->rate = 0;
}
}
 
$percent = $percent / $this->totalPass + ($this->currentPass - 1) / $this->totalPass;
 
$this->percent = floor($percent * 100);
$this->lastOutput = $currentTime;
$this->currentSize = (int) $currentSize;
$this->currentTime = $currentDuration;
 
return $this->getProgressInfo();
}
 
/**
*
* @param string $rawDuration in the format 00:00:00.00
* @return number
*/
private function convertDuration($rawDuration)
{
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) {
$duration += intval($ar[1]) * 60;
}
if (!empty($ar[2])) {
$duration += intval($ar[2]) * 60 * 60;
}
 
return $duration;
}
 
/**
* @return array
*/
private function getProgressInfo()
{
if ($this->remaining === null) {
return null;
}
 
return array(
'percent' => $this->percent,
'remaining' => $this->remaining,
'rate' => $this->rate
);
}
 
private function initialize()
{
try {
$format = $this->ffprobe->format($this->pathfile);
} catch (RuntimeException $e) {
return;
}
 
if (false === $format->has('size') || false === $format->has('duration')) {
return;
}
 
$this->totalSize = $format->get('size') / 1024;
$this->duration = $format->get('duration');
 
$this->initialized = true;
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/ProgressListener/AudioProgressListener.php
@@ -0,0 +1,29 @@
<?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\ProgressListener;
 
/**
* Parses ffmpeg stderr progress information. An example:
*
* <pre>
* size= 3552kB time=00:03:47.29 bitrate= 128.0kbits/s
* </pre>
*
* @author Robert Gruendler <r.gruendler@gmail.com>
*/
class AudioProgressListener extends AbstractProgressListener
{
public function getPattern()
{
return '/size=(.*?) time=(.*?) /';
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/ProgressListener/VideoProgressListener.php
@@ -0,0 +1,29 @@
<?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\ProgressListener;
 
/**
* Parses ffmpeg stderr progress information for video files. An example:
*
* <pre>
* frame= 171 fps=0.0 q=10.0 size= 18kB time=00:00:05.72 bitrate= 26.4kbits/s dup=8 drop=0
* </pre>
*
* @author Robert Gruendler <r.gruendler@gmail.com>
*/
class VideoProgressListener extends AbstractProgressListener
{
public function getPattern()
{
return '/size=(.*?) time=(.*?) /';
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/ProgressableInterface.php
@@ -0,0 +1,31 @@
<?php
 
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <dev.team@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
 
namespace FFMpeg\Format;
 
use Evenement\EventEmitterInterface;
use FFMpeg\FFProbe;
use FFMpeg\Media\MediaTypeInterface;
 
interface ProgressableInterface extends EventEmitterInterface
{
/**
* Creates the progress listener.
*
* @param MediaTypeInterface $media
* @param FFProbe $ffprobe
* @param Integer $pass The current pas snumber
* @param Integer $total The total pass number
*
* @return array An array of listeners
*/
public function createProgressListener(MediaTypeInterface $media, FFProbe $ffprobe, $pass, $total);
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/DefaultVideo.php
@@ -0,0 +1,141 @@
<?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;
 
use FFMpeg\FFProbe;
use FFMpeg\Exception\InvalidArgumentException;
use FFMpeg\Format\Audio\DefaultAudio;
use FFMpeg\Format\VideoInterface;
use FFMpeg\Media\MediaTypeInterface;
use FFMpeg\Format\ProgressListener\VideoProgressListener;
 
/**
* The abstract default Video format
*/
abstract class DefaultVideo extends DefaultAudio implements VideoInterface
{
/** @var string */
protected $videoCodec;
 
/** @var Integer */
protected $kiloBitrate = 1000;
 
/** @var Integer */
protected $modulus = 16;
 
/** @var Array */
protected $additionalParamaters;
 
/**
* {@inheritdoc}
*/
public function getKiloBitrate()
{
return $this->kiloBitrate;
}
 
/**
* Sets the kiloBitrate value.
*
* @param integer $kiloBitrate
* @throws InvalidArgumentException
*/
public function setKiloBitrate($kiloBitrate)
{
if ($kiloBitrate < 1) {
throw new InvalidArgumentException('Wrong kiloBitrate value');
}
 
$this->kiloBitrate = (int) $kiloBitrate;
 
return $this;
}
 
/**
* {@inheritdoc}
*/
public function getVideoCodec()
{
return $this->videoCodec;
}
 
/**
* Sets the video codec, Should be in the available ones, otherwise an
* exception is thrown.
*
* @param string $videoCodec
* @throws InvalidArgumentException
*/
public function setVideoCodec($videoCodec)
{
if ( ! in_array($videoCodec, $this->getAvailableVideoCodecs())) {
throw new InvalidArgumentException(sprintf(
'Wrong videocodec value for %s, available formats are %s'
, $videoCodec, implode(', ', $this->getAvailableVideoCodecs())
));
}
 
$this->videoCodec = $videoCodec;
 
return $this;
}
 
/**
* @return integer
*/
public function getModulus()
{
return $this->modulus;
}
 
/**
* {@inheritdoc}
*/
public function getAdditionalParameters()
{
return $this->additionalParamaters;
}
 
/**
* Sets additional parameters.
*
* @param array $additionalParamaters
* @throws InvalidArgumentException
*/
public function setAdditionalParameters($additionalParamaters)
{
if (!is_array($additionalParamaters)) {
throw new InvalidArgumentException('Wrong additionalParamaters value');
}
 
$this->additionalParamaters = $additionalParamaters;
 
return $this;
}
 
/**
* {@inheritdoc}
*/
public function createProgressListener(MediaTypeInterface $media, FFProbe $ffprobe, $pass, $total)
{
$format = $this;
$listeners = array(new VideoProgressListener($ffprobe, $media->getPathfile(), $pass, $total));
 
foreach ($listeners as $listener) {
$listener->on('progress', function () use ($format, $media) {
$format->emit('progress', array_merge(array($media, $format), func_get_args()));
});
}
 
return $listeners;
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/Ogg.php
@@ -0,0 +1,49 @@
<?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 Ogg video format
*/
class Ogg extends DefaultVideo
{
public function __construct($audioCodec = 'libvorbis', $videoCodec = 'libtheora')
{
$this
->setAudioCodec($audioCodec)
->setVideoCodec($videoCodec);
}
 
/**
* {@inheritDoc}
*/
public function supportBFrames()
{
return true;
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('libvorbis');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableVideoCodecs()
{
return array('libtheora');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/WMV.php
@@ -0,0 +1,49 @@
<?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 WMV video format
*/
class WMV extends DefaultVideo
{
public function __construct($audioCodec = 'wmav2', $videoCodec = 'wmv2')
{
$this
->setAudioCodec($audioCodec)
->setVideoCodec($videoCodec);
}
 
/**
* {@inheritDoc}
*/
public function supportBFrames()
{
return false;
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('wmav2');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableVideoCodecs()
{
return array('wmv2');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/WMV3.php
@@ -0,0 +1,49 @@
<?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 WMV video format
*/
class WMV3 extends DefaultVideo
{
public function __construct($audioCodec = 'wmav3', $videoCodec = 'wmv3')
{
$this
->setAudioCodec($audioCodec)
->setVideoCodec($videoCodec);
}
 
/**
* {@inheritDoc}
*/
public function supportBFrames()
{
return false;
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('wmav3');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableVideoCodecs()
{
return array('wmv3');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/WebM.php
@@ -0,0 +1,57 @@
<?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 WebM video format
*/
class WebM extends DefaultVideo
{
public function __construct($audioCodec = 'libvorbis', $videoCodec = 'libvpx')
{
$this
->setAudioCodec($audioCodec)
->setVideoCodec($videoCodec);
}
 
/**
* {@inheritDoc}
*/
public function supportBFrames()
{
return true;
}
 
/**
* {@inheritDoc}
*/
public function getExtraParams()
{
return array('-f', 'webm');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableAudioCodecs()
{
return array('libvorbis');
}
 
/**
* {@inheritDoc}
*/
public function getAvailableVideoCodecs()
{
return array('libvpx');
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/Video/X264.php
@@ -0,0 +1,94 @@
<?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 boolean */
private $bframesSupport = true;
 
/** @var integer */
private $passes = 2;
 
public function __construct($audioCodec = 'libfaac', $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('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->passes;
}
 
/**
* @return int
*/
public function getModulus()
{
return 2;
}
}
/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Format/VideoInterface.php
@@ -0,0 +1,64 @@
<?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;
 
interface VideoInterface extends AudioInterface
{
/**
* Gets the kiloBitrate value.
*
* @return integer
*/
public function getKiloBitrate();
 
/**
* Returns the modulus used by the Resizable video.
*
* This used to calculate the target dimensions while maintaining the best
* aspect ratio.
*
* @see http://www.undeadborn.net/tools/rescalculator.php
*
* @return integer
*/
public function getModulus();
 
/**
* Returns the video codec.
*
* @return string
*/
public function getVideoCodec();
 
/**
* Returns true if the current format supports B-Frames.
*
* @see https://wikipedia.org/wiki/Video_compression_picture_types
*
* @return Boolean
*/
public function supportBFrames();
 
/**
* Returns the list of available video codecs for this format.
*
* @return array
*/
public function getAvailableVideoCodecs();
 
/**
* Returns the list of available video codecs for this format.
*
* @return array
*/
public function getAdditionalParameters();
}