Вход Регистрация
Файл: vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Video/FrameRateFilter.php
Строк: 45
<?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 FFMpegFiltersVideo;

use 
FFMpegCoordinateFrameRate;
use 
FFMpegFormatVideoInterface;
use 
FFMpegMediaVideo;

class 
FrameRateFilter implements VideoFilterInterface
{
    private 
$rate;
    private 
$gop;
    private 
$priority;

    public function 
__construct(FrameRate $rate$gop$priority 0)
    {
        
$this->rate $rate;
        
$this->gop $gop;
        
$this->priority $priority;
    }

    
/**
     * {@inheritdoc}
     */
    
public function getPriority()
    {
        return 
$this->priority;
    }

    
/**
     * Returns the frame rate.
     *
     * @return FrameRate
     */
    
public function getFrameRate()
    {
        return 
$this->rate;
    }

    
/**
     * Returns the GOP size.
     *
     * @see https://wikipedia.org/wiki/Group_of_pictures
     *
     * @return int
     */
    
public function getGOP()
    {
        return 
$this->gop;
    }

    
/**
     * {@inheritdoc}
     */
    
public function apply(Video $videoVideoInterface $format)
    {
        
$commands = ['-r'$this->rate->getValue()];

        
/*
         * @see http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
         */
        
if ($format->supportBFrames()) {
            
$commands[] = '-b_strategy';
            
$commands[] = '1';
            
$commands[] = '-bf';
            
$commands[] = '3';
            
$commands[] = '-g';
            
$commands[] = $this->gop;
        }

        return 
$commands;
    }
}
Онлайн: 0
Реклама