Reputation: 91
Im new on Azure media services and trying it through php. I am able to upload the file on remote using Multiple Bitrate but it shows not supported. It does generate the URL to access it but shows a MPE_FEATURE_USAGE_FORBIDDEN, i have also enabled the public access from Azure dashboard but still i dont know why it shows that. Then I tried Adaptive bitrate as shown in code but now its not even allowing me to encode it and shows error. In multiple bitrate, im guessing its also a case of encoder error.
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;
}
Any help will be appreciated. Thanks!
Upvotes: 3
Views: 471
Reputation: 1991
You are using wrong preset for a given media processor. Your job encoding probably failing with something like:
"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"
Try using encoder "Media Encoder Standard" with preset "H264 Multiple Bitrate 1080p". As Gary mentioned you can find full list of supported preset names at https://msdn.microsoft.com/library/azure/mt269960.aspx?f=255&MSPPError=-2147217396
Upvotes: 2