gpt4 book ai didi

azure-media-services - 如何在 Azure 媒体服务 V3 中实现字幕?

转载 作者:行者123 更新时间:2023-12-04 15:40:20 30 4
gpt4 key购买 nike

如何使用.net SDK在azure media service 3中完成字幕制作

我正在使用 Azure 媒体服务 v3 教程(https://github.com/Azure-Samples/media-services-v3-dotnet-tutorials)但缺少如何使用 .net SDK 将视频字幕文件(vtt 文件)更新为媒体服务 Assets 。有人可以帮助我吗?

最佳答案

您只需像对待上传的视频一样对待字幕文件。唯一的区别是字幕文件将被放入已有视频的 Assets 中。换句话说,您将上传视频,对其进行编码,然后在输出 Assets 中上传 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 是您的输出 Assets 的名称。

关于azure-media-services - 如何在 Azure 媒体服务 V3 中实现字幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57986861/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com