示例#1
0
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     //		if(array_key_exists($this->_id, KDLConstants::$TranscodersSourceBlackList)) {
     //			$this->_sourceBlacklist = KDLConstants::$TranscodersSourceBlackList[$this->_id];
     //		}
     //		if(array_key_exists($this->_id, KDLConstants::$TranscodersTargetBlackList)) {
     //			$this->_targetBlacklist = KDLConstants::$TranscodersTargetBlackList[$this->_id];
     //		}
     if (parent::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     /*
      * Remove encoding.com for DAR<>PAR
      */
     if ($this->_id == KDLTranscoders::ENCODING_COM && $source->_video && $source->_video->_dar && abs($source->_video->GetPAR() - $source->_video->_dar) > 0.01) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderFormat, $this->_id, "non square pixels");
         return true;
     }
     /*
      * Remove mencoder, encoding.com and cli_encode
      * for audio only flavors
      */
     if (($this->_id == KDLTranscoders::MENCODER || $this->_id == KDLTranscoders::ENCODING_COM || $this->_id == KDLTranscoders::ON2) && $target->_video == null) {
         $warnings[KDLConstants::AudioIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderLimitation, $this->_id);
         return true;
     }
     /*
      * Remove encoding.com and ffmpegs
      * for rotated videos
      */
     if (($this->_id == KDLTranscoders::ENCODING_COM || $this->_id == KDLTranscoders::FFMPEG || $this->_id == KDLTranscoders::FFMPEG_AUX) && $target->_video && $target->_video->_rotation) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderLimitation, $this->_id);
         return true;
     }
     /*
      * Non Mac transcoders should not mess up with QT/WMV/WMA
      * 
      */
     $qt_wmv_list = array("wmv1", "wmv2", "wmv3", "wvc1", "wmva", "wma1", "wma2", "wmapro");
     if (($this->_id == KDLTranscoders::FFMPEG || $this->_id == KDLTranscoders::FFMPEG_AUX) && $source->_container && ($source->_container->_id == "qt" || $source->_container->_format == "qt") && ($source->_video && (in_array($source->_video->_format, $qt_wmv_list) || in_array($source->_video->_id, $qt_wmv_list)) || $source->_audio && (in_array($source->_audio->_format, $qt_wmv_list) || in_array($source->_audio->_id, $qt_wmv_list)))) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderFormat, $this->_id, "qt/wmv/wma");
         return true;
     }
     return false;
 }
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     if (parent::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     if ($this->_id == KDLTranscoders::FFMPEG_AUX) {
         $transcoder = new KDLOperatorFfmpeg($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::FFMPEG) {
         $transcoder = new KDLOperatorFfmpeg0_10($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::MENCODER) {
         $transcoder = new KDLOperatorMencoder($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::ON2) {
         $transcoder = new KDLOperatorOn2($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     /*
      * Remove encoding.com for DAR<>PAR
      */
     if ($this->_id == KDLTranscoders::ENCODING_COM && $source->_video && $source->_video->_dar && abs($source->_video->GetPAR() - $source->_video->_dar) > 0.01) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderFormat, $this->_id, "non square pixels");
         return true;
     }
     return false;
 }
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     return parent::CheckConstraints($source, $target, $errors, $warnings);
 }
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     if (KDLOperatorBase::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     if (!isset($target->_video)) {
         return false;
     }
     /*
      * HD codecs (prores & dnxhd) can be packaged only in MOV/MXF
      */
     $hdCodecsArr = array(KDLVideoTarget::APCO, KDLVideoTarget::APCS, KDLVideoTarget::APCN, KDLVideoTarget::APCH, KDLVideoTarget::DNXHD);
     if (isset($target->_container)) {
         if (!$target->_container->IsFormatOf(array(KDLContainerTarget::MOV, KDLContainerTarget::MXF)) && in_array($target->_video->_id, $hdCodecsArr)) {
             $target->_errors[KDLConstants::ContainerIndex][] = KDLErrors::ToString(KDLErrors::PackageMovOnly, $target->_video->_id);
             return true;
         }
     }
     /*
      * DNXHD - check validity of frame-size/bitrate mix
      */
     /*
     Project Format	Resolution	Frame Size	Bits	FPS		<bitrate>
     1080i / 59.94	DNxHD 220	1920 x 1080	8		29.97	220M
     1080i / 59.94	DNxHD 145	1920 x 1080	8		29.97	145M
     1080i / 50		DNxHD 185	1920 x 1080	8		25		185M
     1080i / 50		DNxHD 120	1920 x 1080	8		25		120M
     1080p / 25		DNxHD 185	1920 x 1080	8		25		185M
     1080p / 25		DNxHD 120	1920 x 1080	8		25		120M
     1080p / 25		DNxHD 36	1920 x 1080	8		25		36M
     1080p / 24		DNxHD 175	1920 x 1080	8		24		175M
     1080p / 24		DNxHD 115	1920 x 1080	8		24		115M
     1080p / 24		DNxHD 36	1920 x 1080	8		24		36M
     1080p / 23.976	DNxHD 175	1920 x 1080	8		23.976	175M
     1080p / 23.976	DNxHD 115	1920 x 1080	8		23.976	115M
     1080p / 23.976	DNxHD 36	1920 x 1080	8		23.976	36M
     1080p / 29.7	DNxHD 45	1920 x 1080	8		29.97	45M
     
     720p  / 59.94	DNxHD 220	1280 x 720	8		59.94	220M
     720p  / 59.94	DNxHD 145	1280 x 720	8		59.94	145M
     720p  / 50		DNxHD 175	1280 x 720	8		50		175M
     720p  / 50		DNxHD 115	1280 x 720	8		50		115M
     720p  / 23.976	DNxHD 90	1280 x 720	8		23.976	90M
     720p  / 23.976	DNxHD 60	1280 x 720	8		23.976	60M
     */
     if ($target->_video->_id == KDLVideoTarget::DNXHD) {
         if (!isset($target->_video->_width) || $target->_video->_width == 0) {
             $width = 0;
         } else {
             $width = $target->_video->_width;
         }
         if (!isset($target->_video->_height) || $target->_video->_height == 0) {
             $height = 0;
         } else {
             $height = $target->_video->_height;
         }
         $dnxhd720BitratesArr = array(220000, 145000, 175000, 115000, 90000, 60000);
         $dnxhd1080BitratesArr = array(220000, 145000, 185000, 120000, 36000, 175000, 115000, 45000);
         if (in_array($target->_video->_bitRate, $dnxhd720BitratesArr) && ($width == 1280 && $height == 720 || $width == 1280 && $height == 0 || $width == 0 && $height == 720)) {
             KalturaLog::log("Supported DNXHD - br:" . $this->_video->_bitRate . ",w:{$width},h:{$height}");
         } else {
             if (in_array($target->_video->_bitRate, $dnxhd1080BitratesArr) && ($width == 1920 && $height == 1080 || $width == 1920 && $height == 0 || $width == 0 && $height == 1080)) {
                 KalturaLog::log("Supported DNXHD - br:" . $target->_video->_bitRate . ",w:{$width},h:{$height}");
             } else {
                 $str = "br:" . $target->_video->_bitRate . ",w:{$width},h:{$height}";
                 $target->_errors[KDLConstants::VideoIndex][] = KDLErrors::ToString(KDLErrors::DnxhdUnsupportedParams, $str);
                 return true;
             }
         }
     }
     return $this->checkBasicFFmpegConstraints($source, $target, $errors, $warnings);
 }
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     if (parent::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     /*
      * Remove ffmpegs
      * for rotated videos
      */
     if ($target->_video && $target->_video->_rotation) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderLimitation, $this->_id);
         return true;
     }
     return $this->checkBasicFFmpegConstraints($source, $target, $errors, $warnings);
 }
示例#6
0
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     if (parent::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     /*
      * Remove mencoder, encoding.com and cli_encode
      * for audio only flavors
      */
     if ($target->_video == null) {
         $warnings[KDLConstants::AudioIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderLimitation, $this->_id);
         return true;
     }
     /*
      * Remove On2
      * for 270 rotated videos
      */
     if ($target->_video && $target->_video->_rotation == 270) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderLimitation, $this->_id);
         return true;
     }
     return false;
 }