hilda_sonica_vish
hilda_sonica_vish

Reputation: 757

not able to create thumbnail(jpeg) from azure media storage?

I am trying to create thumbanil from azure storage after uploading a video,

so i have a xml

 <?xml version="1.0" encoding="utf-8"?>
<Thumbnail Size="30%,*" Type="Jpeg" Filename="abc_1.jpg">
  <Time Value="0:3:19"/>
</Thumbnail>

and in my c# level cod i a creating a job

 IAsset asset = CreateAssetAndUploadSingleFile(inputMediaFilePath,
                "My Video Thumbnail Input Asset",
                AssetCreationOptions.None);

            // Declare a new job.
            IJob job = _context.Jobs.Create("My Video Thumbnail Job");

            // Get a reference to Azure Media Video Thumbnails.
            string MediaProcessorName = "Azure Media Video Thumbnails";

            var processor = GetLatestMediaProcessorByName(MediaProcessorName);

            var ThumbnailConfig = File.ReadAllText("Thumbnail_Configuration.xml");

            // Create a task with the encoding details, using a string preset.
            ITask task = job.Tasks.AddNew("My Video Thumbnail Task",
                processor,
                configuration,
                TaskOptions.None);

but when i run the code i am getting error saying that xml is invalid, what am i doing wrong here?

Upvotes: 0

Views: 98

Answers (2)

johndeu
johndeu

Reputation: 2512

Can you also please share where you found documentation that referred to the following:

// Get a reference to Azure Media Video Thumbnails.
            string MediaProcessorName = "Azure Media Video Thumbnails";

I'd like to have any documentation that you found that referenced that removed.

Upvotes: 0

Anil Murching
Anil Murching

Reputation: 595

The code appears to be using an incorrect combination of the preset XML and the media processor. If you need to generate thumbnails at a specific timestamp, then change the media processor and the preset:

string MediaProcessorName = "Media Encoder Standard";

And in ThumbnailConfig, use the following JSON string:

{
  "Version": 1.0,
  "Codecs": [
    {
      "JpgLayers": [
        {
          "Quality": 90,
          "Type": "JpgLayer",
          "Width": "30%",
          "Height": "30%"
        }
      ],
      "Start": "00:03:19",
      "Step": "1",
      "Range": "1",
      "Type": "JpgImage"
    }
  ],
  "Outputs": [
    {
     "FileName": "abc_{Index}{Extension}",
      "Format": {
        "Type": "JpgFormat"
      }
    }
  ]
}

You can see other examples documented here.

Upvotes: 1

Related Questions