I start new with Azure and Azure PHP sdk because I'm PHP developer. With Azure PHP sdk, I can store video and get video url. Now I want to know how to create video thumbnails with Azure. But I don't know how to do.
答案 0 :(得分:1)
要创建缩略图,您应该像往常一样创建作业,但通过setConfiguration
设置缩略图xml。
这是未经测试的代码但应该有效。
// sets the thumbnail configuration
$thumbnailConfig = <<<EOT
<?xml version="1.0" encoding="utf-8"?>
<Thumbnail Size="50%,*" Type="Jpeg" Filename="{OriginalFilename}_{Size}_{ThumbnailTime}_{ThumbnailIndex}_{Date}_{Time}.{DefaultExtension}">
<Time Value="10%"/>
</Thumbnail>
EOT;
$xmlTask = '<taskBody><inputAsset>JobInputAsset(0)</inputAsset>'
. '<outputAsset>JobOutputAsset(0)</outputAsset></taskBody>';
$mediaProcessor = $restProxy->getLatestMediaProcessor('Azure Media Encoder');
$task = new Task($xmlTask, $mediaProcessor->getId(), TaskOptions::NONE);
$task->setConfiguration($thumbnailConfig);
$restProxy->createJob(new Job(), array($inputAsset), array($task));
您应首先连接到媒体服务,有关详细信息,请转到here
连接摘要:
$restProxy = ServicesBuilder->getInstance()->createMediaServicesService(
new MediaServicesSettings([YourAccountName],
[YourPrimaryOrSecondaryAccessKey]));