Balu Chand
Balu Chand

Reputation: 85

Asset copied from an existing blob with Storage encrypted enabled: encoding fails

I did a successful coping of an existing blob into a media service asset and was able to do an encoding task.

Things changed when I copied the asset with storage encryption enabled.The encoding task for this asset fails with message "Azure Media Encoding of storageencrypted with H264 Adaptive Bitrate MP4 Set 720p UserInput : File type or codec not supported."

                IAsset asset = mediaContext.Assets.Create("NewAsset_" + Guid.NewGuid(), AssetCreationOptions.StorageEncrypted);

Upvotes: 0

Views: 166

Answers (1)

Julien Corioland
Julien Corioland

Reputation: 1105

Here is a working sample of what you are trying to do:

string mediaservicename = "your_media_service_name";
string mediaservicekey = "your_media_service_key";

// create the cloud media context
var mediaServiceContext = new CloudMediaContext(mediaservicename, mediaservicekey);

// create an encrypted asset
var asset = mediaServiceContext.Assets.Create("MyAsset_" + Guid.NewGuid(), AssetCreationOptions.StorageEncrypted);

// create the asset file and upload it from a local path
var assetFile = asset.AssetFiles.Create("BigBuckBunny_320x180.mp4");
assetFile.Upload(@"C:\Users\jucoriol\Desktop\BigBuckBunny_320x180.mp4");

// create the encoding job with a single task
var encodingJob = mediaServiceContext.Jobs.CreateWithSingleTask(
    "Azure Media Encoder",
    "H264 Adaptive Bitrate MP4 Set 720p",
    asset,
    "Big Bunny Adaptive 720p",
    AssetCreationOptions.StorageEncrypted);

// submit the job
encodingJob.Submit();

Console.ReadLine();

I think that the problem is not about storage encryption but could be :

  • The media that uses a not supported codec. In case you did not yet, you can try to encode it without encryption (you can do a quick test using Azure Media Service Explorer : https://github.com/Azure/Azure-Media-Services-Explorer)
  • Another common mistake is to create the asset file without extension in the name. Azure Media Encoder requires that the file has a valid extension. I have got this error message on files that do not had valid extensions.

Hope this helps to resolve your problem.

Julien

Upvotes: 2

Related Questions