简体   繁体   English

Azure媒体服务:使用视频编码生成缩略图

[英]Azure media service:Generate thumbnail with video encode

I am using azure media service to generate encode,trim video. 我正在使用azure媒体服务来生成编码,修剪视频。 Now i want to generate video thumbnail with custom encoding preset. 现在,我想生成具有自定义编码预设的视频缩略图。 Here what i used to encode video and generate thumbnail: 这是我用来编码视频并生成缩略图的内容:

{
"Version": "1.0",
  "Sources": [
    {
      "StartTime": "00:00:00",
      "Duration": "00:01:00"
    }
  ],
  "Codecs": [
    {
      "Type": "CopyVideo"
    },
    {
      "Type": "CopyAudio"
    },
    {
      "PngLayers": [
        {
          "Type": "PngLayer",
          "Width": 150,
          "Height": 150
        }
      ],
      "Start": "{Best}",
      "Type": "PngImage"
    }
  ],
  "Outputs": [
    {
      "FileName": "e3cb10a2-1580-49f7-ad29-99c44f5bc936_{Width}x{Height}_{VideoBitrate}.mp4",
      "Format": {
        "Type": "MP4Format"
      }
    },
    {
      "FileName": "{Basename}_{Index}{Extension}",
      "Format": {
        "Type": "PngFormat"
      }
    }
  ]
}

while i am trying to encode video and generate thumbnail, getting this error: 当我尝试编码视频并生成缩略图时,出现此错误:

The preset results in multiple outputs with same name. 预设将导致多个具有相同名称的输出。 Either use unique file names or use macros to disambiguate! 使用唯一的文件名或使用宏来消除歧义!

Above code is work perfect if i remove thumbnail configuration and doing just video encoding. 如果我删除缩略图配置并仅进行视频编码,则以上代码是完美的工作。

Can any one suggest is it possible to generate thumbnail with copyaudio and copyvideo codecs? 有人可以建议用copyaudiocopyvideo编解码器生成缩略图吗?

It's mandatory for Thumbnail generation to use the macro {Index} in the filename output. 缩略图生成必须在文件名输出中使用宏{Index}。 That shall solve the issue. 那将解决问题。 Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM