gpt4 book ai didi

php - Azure 媒体服务 sdk 在编码到自适应比特率 MP4 集时返回错误

转载 作者:搜寻专家 更新时间:2023-10-31 21:02:49 24 4
gpt4 key购买 nike

我是 Azure 媒体服务的新手,并通过 php 尝试它。我可以使用多比特率远程上传文件,但显示不支持。它确实生成了访问它的 URL,但显示了 MPE_FEATURE_USAGE_FORBIDDEN,我还启用了从 Azure 仪表板的公共(public)访问,但我仍然不知道为什么它显示这一点。然后我尝试了代码中所示的自适应比特率,但现在它甚至不允许我对其进行编码并显示错误。在多个比特率下,我猜测这也是编码器错误的情况。

function encodeToAdaptiveBitrateMP4Set($restProxy, $asset) {
// 2.1 retrieve the latest 'Media Encoder Standard' processor version
$mediaProcessor = $restProxy->getLatestMediaProcessor('Media Encoder Standard');

print "Using Media Processor: {$mediaProcessor->getName()} version {$mediaProcessor->getVersion()}\r\n";

// 2.2 Create the Job; this automatically schedules and runs it
$outputAssetName = "Encoded " . $asset->getName();
$outputAssetCreationOption = Asset::OPTIONS_NONE;
$taskBody = '<?xml version="1.0" encoding="utf-8"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset assetCreationOptions="' . $outputAssetCreationOption . '" assetName="' . $outputAssetName . '">JobOutputAsset(0)</outputAsset></taskBody>';

$task = new Task($taskBody, $mediaProcessor->getId(), TaskOptions::NONE);
$task->setConfiguration('H264 Adaptive Bitrate MP4 Set 1080p');

$job = new Job();
$job->setName('Encoding Job');

$job = $restProxy->createJob($job, array($asset), array($task));

print "Created Job with Id: {$job->getId()}\r\n";

// 2.3 Check to see if the Job has completed
$result = $restProxy->getJobStatus($job);

$jobStatusMap = array('Queued', 'Scheduled', 'Processing', 'Finished', 'Error', 'Canceled', 'Canceling');

while($result != Job::STATE_FINISHED && $result != Job::STATE_ERROR && $result != Job::STATE_CANCELED) {
print "Job status: {$jobStatusMap[$result]}\r\n";
sleep(5);
$result = $restProxy->getJobStatus($job);
}

if ($result != Job::STATE_FINISHED) {
print "The job has finished with a wrong status: {$jobStatusMap[$result]}\r\n";
exit(-1);
}

print "Job Finished!\r\n";

// 2.4 Get output asset
$outputAssets = $restProxy->getJobOutputMediaAssets($job);
$encodedAsset = $outputAssets[0];

print "Asset encoded: name={$encodedAsset->getName()} id={$encodedAsset->getId()}\r\n";

return $encodedAsset;

}

任何帮助将不胜感激。谢谢!

最佳答案

您对给定媒体处理器使用了错误的预设。您的作业编码可能会失败,如下所示:

"An error has occurred. Stage: ParsePreset. Code: Microsoft.Cloud.Media.Encoding.PresetException.

Microsoft.Cloud.Media.Encoding.PresetException: Invalid Preset String: H264 Adaptive Bitrate MP4 Set 1080p"

尝试使用预设为“H264 多比特率 1080p”的编码器“Media Encoder Standard”。正如加里提到的,您可以在 https://msdn.microsoft.com/library/azure/mt269960.aspx?f=255&MSPPError=-2147217396 找到支持的预设名称的完整列表。

关于php - Azure 媒体服务 sdk 在编码到自适应比特率 MP4 集时返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38571576/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com