您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

生成缩略图子画面Generate a thumbnail sprite

媒体服务徽标media services logo


可以使用 Media Encoder Standard 生成缩略图子画面,该子画面是一个 JPEG 文件,其中包含可拼结为单个大图像的多个小分辨率缩略图,以及一个 VTT 文件。You can use Media Encoder Standard to generate a thumbnail sprite, which is a JPEG file that contains multiple small resolution thumbnails stitched together into a single (large) image, together with a VTT file. 此 VTT 文件指定每个缩略图在输入视频中代表的时间范围,以及该缩略图在 JPEG 大文件中的大小和坐标。This VTT file specifies the time range in the input video that each thumbnail represents, together with the size and coordinates of that thumbnail within the large JPEG file. 视频播放器使用 VTT 文件和子画面图像来显示一个“视觉对象”拖动条,提供一个查看器,用于在沿视频时间线前后推移时提供可视反馈。Video players use the VTT file and sprite image to show a 'visual' seekbar, providing a viewer with visual feedback when scrubbing back and forward along the video timeline.

为了使用 Media Encoder Standard 生成缩略图子画面,预设需要满足以下条件:In order to use Media Encoder Standard to generate Thumbnail Sprite, the preset:

  1. 必须使用 JPG 缩略图图像格式Must use JPG thumbnail image format

  2. 必须将 Start/Step/Range 值指定为时间戳或 % 值(而不是帧数)Must specify Start/Step/Range values as either timestamps, or % values (and not frame counts)

    1. 可以混合使用时间戳和 % 值It is okay to mix timestamps and % values
  3. 必须具有 SpriteColumn 值,并且必须为大于或等于 1 的非负数Must have the SpriteColumn value, as a non-negative number greater than or equal to 1

    1. 若将 SpriteColumn 设置为 M > = 1,输出图像则是带有 M 列的矩形。If SpriteColumn is set to M >= 1, the output image is a rectangle with M columns. 若通过 #2 生成的缩略图数量不是 M 的精确倍数,则最后一行将不完整且留有黑色像素。If the number of thumbnails generated via #2 is not an exact multiple of M, the last row will be incomplete, and left with black pixels.

以下是示例:Here is an example:

{
    "Version": 1.0,
    "Codecs": [
    {
      "Start": "00:00:01",
      "Type": "JpgImage",
      "Step": "5%",
      "Range": "100%",
      "JpgLayers": [
        {
          "Type": "JpgLayer",
          "Width": "10%",
          "Height": "10%",
          "Quality": 90
        }
      ],
      "SpriteColumn": 10
    }
      ],
      "Outputs": [
        {
          "FileName": "{Basename}_{Index}{Extension}",
          "Format": {
            "Type": "JpgFormat"
          }
        }
   ]
}

已知问题Known Issues

  1. 无法生成包含单行图像的子画面图像(SpriteColumn = 1 时生成的图像包含一列)。It's not possible to generate a sprite image with a single row of images (SpriteColumn = 1 results in an image with a single column).
  2. 尚不支持将子画面图像分块为中等大小的 JPEG 图像。Chunking of the sprite images into moderately sized JPEG images is not supported yet. 因此,必须审慎限制缩略图的数量和大小,使拼结成的缩略图子画面像素约为 8M。Hence, care must be taken to limit the number of thumbnails and their size, so that the resultant stitched Thumbnail Sprite is around 8M pixels or less.
  3. Azure Media Player 在 Microsoft Edge、Chrome 和 Firefox 浏览器上支持子画面。Azure Media Player supports sprites on Microsoft Edge, Chrome, and Firefox browsers. IE11 不支持 VTT 分析服务。VTT parsing is not supported in IE11.

后续步骤Next steps

对内容进行编码Encode content