azure-media-services - 如何在 Azure 媒体服务 V3 中实现字幕?
问题描述
如何使用.net SDK在azure media service 3中完成字幕
我正在使用 Azure 媒体服务 v3 教程(https://github.com/Azure-Samples/media-services-v3-dotnet-tutorials),但缺少如何将视频字幕文件(vtt 文件)更新为媒体服务资产使用.net SDK。一些身体可以帮助我吗?
解决方案
您只需像对待上传的视频一样对待字幕文件。唯一的区别是字幕文件将被放入已经有视频的资产中。换句话说,您将上传视频,对其进行编码,然后在输出资产中上传 VTT 文件。
从代码的角度来看,您将使用:
// Use Media Services API to get back a response that contains
// SAS URL for the Asset container into which to upload blobs.
// That is where you would specify read-write permissions
// and the exparation time for the SAS URL.
var response = await client.Assets.ListContainerSasAsync(
resourceGroupName,
accountName,
assetName,
permissions: AssetContainerPermission.ReadWrite,
expiryTime: DateTime.UtcNow.AddHours(4).ToUniversalTime());
var sasUri = new Uri(response.AssetContainerSasUrls.First());
// Use Storage API to get a reference to the Asset container
// that was created by calling Asset's CreateOrUpdate method.
CloudBlobContainer container = new CloudBlobContainer(sasUri);
var blob = container.GetBlockBlobReference(Path.GetFileName(fileToUpload));
// Use Strorage API to upload the file into the container in storage.
await blob.UploadFromFileAsync(fileToUpload);
其中assetName 是您的输出资产的名称。
推荐阅读
- windows-subsystem-for-linux - 多个 WSL 如何使用不同的文件系统?
- react-native - Native Base:是否可以设置 Select 的禁用状态?
- blockchain - 我怎样才能让巧克力蛋糕中的所有 ERC20 地址在前端使用
- javascript - 在 Chrome Android/App 上禁用空格作为输入字段中的第一个字符
- c# - 发送 get 请求时不带括号返回
- python - 跨数据框交叉引用公共值/在 python 中创建 itertool 组合
- excel - 如何分别转置多个 .txt 文件并将它们组合成 1 个 csv 文件
- python - 为什么熊猫数据框在识别列时显示错误?
- node.js - Ajv:错误:严格模式:未知关键字:“$schema”
- python - scipy.optimize.newton - 容差参数 tol 不是指函数的结果,而是指输入的容差?