Ejemplo n.º 1
0
 public function __construct($input_output_type, Config $config = null)
 {
     parent::__construct($config);
     $this->setType($input_output_type);
     $this->_additional_commands = array();
     $this->_removed_commands = array();
     $this->_media_object = null;
     $this->_format = array('quality' => null, 'format' => null, 'strictness' => null, 'preset_options_file' => null, 'threads' => null);
     $this->_format_to_command = array('quality' => '-q <setting>', 'format' => '-f <setting>', 'strictness' => '-strict <setting>', 'preset_options_file' => '-fpre <setting>', 'threads' => '-threads <setting>');
     //			add default input/output commands
     if ($input_output_type === 'output') {
         $this->setThreads(1)->setStrictness('experimental')->setQualityVsStreamabilityBalanceRatio(4);
     } else {
         if ($input_output_type === 'input') {
         } else {
             throw new Exception('Unrecognised input/output type "' . $input_output_type . '" set in \\PHPVideoToolkit\\Format::__construct');
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * @access public
  * @author: Oliver Lillie
  * @param  constant $input_output_type Either Format::INPUT or Format::OUTPUT. Defaults to OUTPUT. It determines the format
  *  mode used to set various commands in the final ffmpeg exec call.
  * @param  PHPVideoToolkit\Config $config The config object.
  * @throws \InvalidArgumentException If the $input_output_type is not valid.
  */
 public function __construct($input_output_type = Format::OUTPUT, Config $config = null)
 {
     parent::__construct($config);
     $this->setType($input_output_type);
     $this->_additional_commands = array();
     $this->_removed_commands = array();
     $this->_media_object = null;
     $this->_format = array('quality' => null, 'format' => null, 'strictness' => null, 'preset_options_file' => null, 'threads' => null, 'threads_indexed' => null);
     $ffmpeg = new FfmpegParser();
     $available_commands = $ffmpeg->getCommands();
     if (isset($available_commands['crf'])) {
         $quality_command = '-crf <setting>';
     } else {
         if (isset($available_commands['q']) === true) {
             $quality_command = '-q <setting>';
         } else {
             $quality_command = '-qscale <setting>';
         }
     }
     $this->_format_to_command = array('quality' => $quality_command, 'format' => '-f <setting>', 'strictness' => '-strict <setting>', 'preset_options_file' => '-fpre <setting>', 'threads' => '-threads <setting>', 'threads_indexed' => '-threads:<index> <setting>');
     //          add default input/output commands
     if ($input_output_type === self::OUTPUT) {
         if ($this->_config->set_default_output_format === true) {
             $this->setThreads(1)->setStrictness('experimental')->setQualityVsStreamabilityBalanceRatio(4);
         }
     } else {
         if ($input_output_type === self::INPUT) {
         } else {
             throw new \InvalidArgumentException('Unrecognised input/output type "' . $input_output_type . '" set in \\PHPVideoToolkit\\Format::__construct');
         }
     }
 }