Example #1
0
 /**
  * undocumented function
  *
  * @access public
  * @author Oliver Lillie
  * @return void
  */
 public function updateFormatOptions(&$save_path)
 {
     parent::updateFormatOptions($save_path);
     //			if we have a rotation and it's set to true then we must autodetect the rotation according to the
     //			meta data available.
     //			!IMPORTANT that auto orientation is done before any automatic flipping.
     if (empty($this->_format['video_rotation']) === false && $this->_format['video_rotation'] === true) {
         $video_data = $this->_media_object->readVideoComponent();
         if (empty($video_data['rotation']) === false) {
             $current_rotation = (int) $video_data['rotation'];
             $this->setVideoRotation(-$current_rotation);
             $this->addCommand('-metadata:s:v', 'rotate=""');
         } else {
             $this->_format['video_rotation'] = null;
         }
     }
     //			if video padding has been set we might need to update the width/height dimensions of the pad filter
     if (empty($this->_format['video_padding']) === false) {
         $padding = $this->_format['video_padding'];
         if (empty($padding['width']) === true || empty($padding['height']) === true) {
             $this->setVideoPadding($padding['_padding']['top'], $padding['_padding']['right'], $padding['_padding']['bottom'], $padding['_padding']['left'], $padding['width'], $padding['height'], $padding['colour']);
         }
     }
     // TODO expand the video_filters format data
     if (empty($this->_format['video_filters']) === false) {
     }
     return $this;
 }
Example #2
0
 /**
  * Constructor
  *
  * @access public
  * @author Oliver Lillie
  * @param  constant $input_output_type Determines the input/output type of the Format. Either PHPVideoToolkit\Format::INPUT 
  *  or PHPVideoToolkit\Format::OUTPUT
  * @param  PHPVideoToolkit\Config $config The config object.
  */
 public function __construct($input_output_type = Format::OUTPUT, Config $config = null)
 {
     parent::__construct($input_output_type, $config);
     if ($input_output_type === 'output') {
         $this->setAudioCodec('acc')->setFormat('acc');
     }
     $this->_restricted_audio_codecs = array('libfdk_aac', 'acc');
 }
Example #3
0
 public function __construct($input_output_type, Config $config = null)
 {
     parent::__construct($input_output_type, $config);
     if ($input_output_type === 'output') {
         $this->setAudioCodec('libmp3lame')->setFormat('mp3');
     }
     $this->_restricted_audio_codecs = array('libmp3lame', 'mp3');
 }
 /**
  * undocumented function
  *
  * @access public
  * @author Oliver Lillie
  * @return void
  */
 public function updateFormatOptions(&$save_path, $overwrite)
 {
     parent::updateFormatOptions($save_path, $overwrite);
     //          adjust the sample frequency if the audio codec is acc and frequency is not already set.
     if (in_array($this->_format['audio_codec'], array('libfdk_aac', 'aac')) === true && $this->_format['audio_sample_frequency'] === null) {
         $this->setAudioSampleFrequency(22050);
     }
     $video_data = $this->_media_object->readVideoComponent();
     //          check to see if the aspect ratio has fixed the width and heights, if so we must apply the size to any output.
     if ($video_data['dimensions']['aspect_ratio_fix_warning'] === true) {
         $this->setVideoDimensions($video_data['dimensions']['width'], $video_data['dimensions']['height']);
     }
     //          if we have a rotation and it's set to true then we must autodetect the rotation according to the
     //          meta data available.
     //          !IMPORTANT that auto orientation is done before any automatic flipping.
     if (empty($this->_format['video_rotation']) === false && $this->_format['video_rotation'] === true) {
         if (empty($video_data['rotation']) === false) {
             $current_rotation = (int) $video_data['rotation'];
             $this->setVideoRotation(-$current_rotation);
             $this->addCommand('-metadata:s:v', 'rotate=""');
         } else {
             $this->_format['video_rotation'] = null;
         }
     }
     //          if the aspect ratio of the rotated video is not the same as the final video we must update the final outputs
     //          aspect ratio. However, we will only automatically do this if the aspect ratio is not already set.
     if (in_array($this->_format['video_rotation'], array(1, 2)) === true && $this->_format['video_aspect_ratio'] === null) {
         $aspect_ratio = $video_data['display_aspect_ratio'];
         if (preg_match('/^[0-9]+\\.[0-9]+$/', $aspect_ratio, $_m) > 0) {
             $this->setVideoAspectRatio(1 / $aspect_ratio);
         } else {
             if (preg_match('/^([0-9]+):([0-9]+)$/', $aspect_ratio, $matches) > 0) {
                 $this->setVideoAspectRatio($matches[2] . ':' . $matches[1]);
             }
         }
     }
     //          if video padding has been set we might need to update the width/height dimensions of the pad filter
     if (empty($this->_format['video_padding']) === false) {
         $padding = $this->_format['video_padding'];
         if (empty($padding['width']) === true || empty($padding['height']) === true) {
             $this->setVideoPadding($padding['_padding']['top'], $padding['_padding']['right'], $padding['_padding']['bottom'], $padding['_padding']['left'], $padding['width'], $padding['height'], $padding['colour']);
         }
     }
     // TODO expand the video_filters format data
     if (empty($this->_format['video_filters']) === false) {
     }
     return $this;
 }