Azure Media服务获取缩略图文件URL
我们目前正在使用Azure Media Services上传视频。当作业在媒体服务中运行时,它会创建缩略图。我可以从Azure Portal导航到它。
工作完成后,我们使用事件网格并具有处理事件的代码。我们以Jonobject接收,
outputs {[
{
"@odata.type": "#Microsoft.Media.JobOutputAsset",
"assetName": "output-06982218-ecb1-4680-8cd4-c6800d991fba",
"error": null,
"label": "BuiltInStandardEncoderPreset_0",
"progress": 100,
"state": "Finished"
}
]}
如果我导航到Azure Portal中的该输出资产,它显示
Asset-A55536B5C-3024-4162-
AD78-81F5448D3F68
存储容器: Uptuf-06982218-ECB1-4680-8CD4-C6800D991FBA
我如何将URL一般到达
资产-A5536B5C-3024-4162-AD78-81F5448D3F68/THUMBNAIL000001.JPG
哪个缩略图文件?
我们想将其存储在数据库中以供以后使用。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AMS中的每个资产上都有一个集装箱名称属性。
您可以使用它来查找存储资产内容的容器,包括MP4文件,清单,元数据以及任何输出缩略图JPG或PNG或VTT文件。
为了访问此问题,只需使用存储客户端SDK即可。我们有许多使用Storage Client SDK中的示例存储库中下载内容的示例。
查看Node/Typescript(用于使用存储客户端SDKS下载内容的各种示例)。
https:/github.com/ Azure-Samples/Media-Services-V3-Node-Tutorials/Tree/Main/Main/videoencoding/encoding_sprite_thumbnail
如果您只需要获取该文件的URL,也可以使用GetContainerSas在资产上创建SAS URL方法,然后将您想要的文件的名称附加到该SAS URL,然后使用URL直接下载它。
https://learlearn.microsoft.com/ en-us/rest/api/媒体/资产/列表范围内 - sas
请注意,GetContainersas将为您提供SAS URL。您仍然必须使用一些URL路径库将.jpg或.png映像的名称附加到该URL的末尾,但请保留带有令牌的查询字符串。
更新:我还创建了一个快速的Typescript/node.js示例,以显示如何使用自己的容器名称创建资产,以及如何将其恢复。
更新2:添加了.net的另一个示例这里 - https:// github。 com/azure-samples/Media-Services-v3-dotnet/blob/main/Assets/program.cs
Every Asset in AMS has a container name property on it.
You can use that to find the container that stores your contents for the asset including the MP4 files, manifests, metadata, and any output thumbnail JPG or PNG or VTT files.
To get access to that, just use the Storage Client SDKs. We have many samples of downloading content using storage client SDKs in our sample repos.
https://learn.microsoft.com/en-us/rest/api/media/assets/get#asset
Check out the Node/Typescript ones for various examples of using the Storage client SDKS to download content.
https://github.com/Azure-Samples/media-services-v3-node-tutorials/tree/main/VideoEncoding/Encoding_Sprite_Thumbnail
If you need to just get a URL to that file, you can also create a SAS URL on the Asset using the GetContainerSAS method and then append the name of the file you want to that SAS URL and download it directly using the URL.
https://learn.microsoft.com/en-us/rest/api/media/assets/list-container-sas
Just note that GetContainerSAS will give you a SAS URL to the container. You still have to use some URL Path library to append the name of your .jpg or .png image to the end of that URL, but preserve the query string with the token on it.
UPDATE: I also created a quick Typescript/Node.js sample to show how to create an Asset with your own container name, and how to get it back.
https://github.com/Azure-Samples/media-services-v3-node-tutorials/blob/main/Assets/get-container-from-asset.ts
UPDATE 2: Added another sample for .NET here - https://github.com/Azure-Samples/media-services-v3-dotnet/blob/main/Assets/Program.cs