2013-07-18 34 views
0

我正在使用以下代码将DRM应用于我的视频文件。但是任务失败了,我应该怎么做才能做到这一点?Azure视频上传任务失败@“我的PlayReady任务”错误:MediaProcessor:执行任务期间发生异常

我可以看到“我的PlayReady任务”达到100%,并突然引发错误。

错误详细信息: 我的PlayReady的任务 MediaProcessor:任务的执行

几天就回来,它正在过程中出现的异常。不知道现在发生了什么?

********************Code sample ************************************************* 
private static IJob EncodeToAdaptiveBitrateAndConvertToSmoothAndProtect(string inputMediaFilePath, string configFilePath) 
     { 
      // Create asset and upload file 
      IAsset asset = CreateAssestAndUploadSingleFile(AssetCreationOptions.None, inputMediaFilePath); 

      // Create a new Job 
      IJob job = mediaContext.Jobs.Create("Encode to multi-bitrate and convert to smooth job"); 


      // Create a new task to encode to Adaptive Bitrate 

      // Get a reference to the Windows Azure Media Encoder 
      IMediaProcessor encoder = GetLatestMediaProcessorByName("Windows Azure Media Encoder"); 

      ITask adpativeBitrateTask = job.Tasks.AddNew("MP4 to Adaptive Bitrate Task", 
       encoder, 
       "H264 Adaptive Bitrate MP4 Set 720p", 
       TaskOptions.None); 

      // Specify the input Asset 
      adpativeBitrateTask.InputAssets.Add(asset); 

      // Add a new output Asset 
      IAsset abrAsset = adpativeBitrateTask.OutputAssets.AddNew("Adaptive Bitrate Asset", AssetCreationOptions.None); 


      // Create a new task to convert the Adaptive Bitrate Asset to a Smooth Streaming Asset 

      // Get a reference to the Windows Azure Media Packager 
      IMediaProcessor packager = GetLatestMediaProcessorByName("Windows Azure Media Packager"); 

      // Windows Azure Media Packager does not accept string presets, so load xml configuration 
      string smoothConfig = File.ReadAllText(configFilePath); 

      // Create a new Task to convert adaptive bitrate to Smooth Streaming 
      ITask smoothStreamingTask = job.Tasks.AddNew("Adaptive Bitrate to Smooth Task", 
       packager, 
       smoothConfig, 
       TaskOptions.None); 

      // Specify the input Asset, which is the output Asset from the first task 
      smoothStreamingTask.InputAssets.Add(abrAsset); 

      // Add a new output Asset 
      IAsset smoothOutputAsset = smoothStreamingTask.OutputAssets.AddNew("Smooth Asset", AssetCreationOptions.None); 

      // Set up the third task to protect the Adaptive Bitrate Smooth Streaming Asset with PlayReady. 

      // Get a media encryptor reference 
      IMediaProcessor playreadyProcessor = GetLatestMediaProcessorByName("Windows Azure Media Encryptor"); 

      // Read the configuration XML 
      string configPlayReady = File.ReadAllText(configFilePathPlayReady); 

      // Create a third task. 
      ITask playreadyTask = job.Tasks.AddNew("My PlayReady Task", 
       playreadyProcessor, 
       configPlayReady, 
       TaskOptions.ProtectedConfiguration); 

      // Add the input asset, which is the smooth streaming output asset from the second task. 
      playreadyTask.InputAssets.Add(smoothOutputAsset); 

      // Add an output asset to contain the results of the job. 
      playreadyTask.OutputAssets.AddNew("PlayReady protected output asset", AssetCreationOptions.None); 

      // Use the following event handler to check job progress. 
      job.StateChanged += new EventHandler<JobStateChangedEventArgs>(StateChanged); 

      // Launch the job. 
      job.Submit(); 

      // Optionally log job details. 
      LogJobDetails(job.Id); 

      // Check job execution and wait for job to finish. 
      Task progressJobTask = job.GetExecutionProgressTask(CancellationToken.None); 
      progressJobTask.Wait(); 

      // Get a refreshed job reference after waiting on a thread. 
      job = GetJob(job.Id); 

      // Check for error 
      if (job.State == JobState.Error) 
      { 
       Console.WriteLine("\nExiting method due to job error."); 
      } 
      return job; 

     } 
+0

您是否使用几星期前工作的相同媒体文件或新媒体文件?尝试使用曾经工作的媒体文件。 – astaykov

+0

我使用相同的媒体文件..它从Azure工作正常 - http://prashanthtest.origin.mediaservices.windows.net/925e4aaa-003a-45e4-a872-9a63a42fd116/dizzy.ism/Manifest –

+0

甚至现在,流畅的流式传输网址正常运行,只有Playready部分在达到100%后才会失败 –

回答

0
您正在使用什么PlayReady许可证服务器

? 从代码角度看,一切看起来都不错。由于Playready保护预设未包含在示例中,因此我认为它看起来与以下文章中的示例相似:http://msdn.microsoft.com/en-us/library/windowsazure/dn189154.aspx 请确保licenseAquisitionURL中的值可从公共网络访问,并且您的keySeedValue或keyID和contentKey仍然有效。

0

是否有可以从失败的实例共享的jobID?

相关问题