public static function CDLProceessFlavorsForCollection($cdlFlavorList) { $kdlFlavorList = array(); foreach ($cdlFlavorList as $cdlFlavor) { $kdlFlavor = KDLWrap::ConvertFlavorCdl2Kdl($cdlFlavor); $kdlFlavorList[] = $kdlFlavor; } $xml = KDLProcessor::ProceessFlavorsForCollection($kdlFlavorList); KalturaLog::log(__METHOD__ . "-->" . $xml . "<--"); foreach ($kdlFlavorList as $kdlFlavor) { $kdlFlavor->_cdlObject->setVideoBitrate($kdlFlavor->_video->_bitRate); } return $xml; }
public static function CDLProceessFlavorsForCollection($cdlFlavorList) { $kdlFlavorList = array(); foreach ($cdlFlavorList as $cdlFlavor) { $kdlFlavor = KDLWrap::ConvertFlavorCdl2Kdl($cdlFlavor); $kdlFlavorList[] = $kdlFlavor; } $xml = KDLProcessor::ProceessFlavorsForCollection($kdlFlavorList); KalturaLog::log(__METHOD__ . "-->" . $xml . "<--"); return $xml; }
public static function runMediasetTest(KDLMediaDataSet $mediaSet, &$dlPrc, $profile = null) { $inFile = realpath($mediaSet->_container->_fileName); //$mediaSet = 100; //new KDLMediaDataSet(); KalturaLog::log("....S-->" . $mediaSet->ToString()); // unset($targetList); // Remarked by Tan-Tan $targetList doesn't exist $targetList = array(); $errors = array(); $warnings = array(); $dlPrc = new KDLProcessor(); $dlPrc->Generate($mediaSet, $profile, $targetList); $dlPrc->_targets = $targetList; $errors = $errors + $dlPrc->get_errors(); $warnings = $warnings + $dlPrc->get_warnings(); if (count($errors) > 0) { $rv = false; } else { $rv = true; } if ($rv == false) { KalturaLog::log("....E==>"); print_r($errors); KalturaLog::log("\n"); } KalturaLog::log("....W==>"); print_r($warnings); KalturaLog::log("\n"); if ($profile == null) { return; } $xmlStr = KDLProcessor::ProceessFlavorsForCollection($targetList); KalturaLog::log(__METHOD__ . "-->XML-->\n" . print_r($xmlStr, true) . "\n<--"); foreach ($targetList as $target) { $output = array(); $rv = 0; KalturaLog::log("...T-->" . $target->ToString()); $outFile = "aaa1.mp4"; if (file_exists($outFile)) { unlink($outFile); } $cmdLineGenerator = $target->SetTranscoderCmdLineGenerator($inFile, $outFile); $cmdLineGenerator->_clipDur = 10000; $exeStr = "FFMpeg " . $cmdLineGenerator->FFMpeg(null); // KalturaLog::log( ".CMD-->".$exeStr); $exeStr = "cli_encode " . $cmdLineGenerator->Generate(new KDLOperationParams(KDLTranscoders::ON2), 1000); kLog::log(".CMD-->" . $exeStr); $exeStr = "mencoder " . $cmdLineGenerator->Generate(new KDLOperationParams(KDLTranscoders::MENCODER), 1000); kLog::log(".CMD-->" . $exeStr); $exeStr = "ffmpeg " . $cmdLineGenerator->Generate(new KDLOperationParams(KDLTranscoders::FFMPEG), 1000); kLog::log(".CMD-->" . $exeStr); exec($exeStr, $output, $rv); kLog::log("..RV-->In" . $inFile . "==>"); if (!file_exists($outFile) || kFile::fileSize($outFile) == 0) { kLog::log("Failed"); } else { kLog::log("Succeeded, Filesize:" . kFile::fileSize($outFile)); $mediaInfoStr = shell_exec(MediaInfoProgram . " " . realpath($outFile)); $medLoader = new KDLMediaInfoLoader($mediaInfoStr); $product = new KDLFlavor(); $medLoader->Load($product); $target->ValidateProduct($mediaSet, $product); kLog::log("\n" . $mediaInfoStr); // kLog::log( ".PRD-->".$product->ToString()); // unlink($outFile); } } }