Search code examples
azure-media-services

How to get thumbnail of Videos in Azure media services via REST API


I am using azure media services for mobile application.It works properly.I just Want to get the thumbnails of published assets via REST API.I need API endpoints for thumbnails.


Solution

  • I read sample code and try to start a job using the AMS RestAPI(V2).

    Then,you can create a SASLocator to download thumbnail when the job is finished.

    POST {{RESTAPIEndpoint}}/Jobs
    {
      "Name": "NewThumbnailJOB",
      "InputMediaAssets": [{
        "__metadata": {
          "uri": "{{RESTAPIEndpoint}}/Assets('nb:cid:UUID:xxxxx')"
        }
      }],
      "Tasks": [{
        "Configuration":"{
          \"Version\": 1.0,
          \"Codecs\": [
            {
              \"PngLayers\": [
                {
                  \"Type\": \"PngLayer\",
                  \"Width\": \"100%\",
                  \"Height\": \"100%\"
                }
              ],
              \"Start\": \"{Best}\",
              \"Type\": \"PngImage\"
            }
          ],
          \"Outputs\": [
            {
              \"FileName\": \"{Basename}_{Index}{Extension}\",
              \"Format\": {
                \"Type\": \"PngFormat\"
              }
            }
          ]
        }
    ",
        "MediaProcessorId": "{{Media Encoder Standard ID}}",
        "TaskBody": "<?xml version=\"1.0\" encoding=\"utf-8\"?>
                    <taskBody>
                        <inputAsset>JobInputAsset(0)</inputAsset>
                        <outputAsset>JobOutputAsset(0)</outputAsset>
                    </taskBody>"
      }]
    }