gpt4 book ai didi

c# - Youtube API 从免费库上传视频和添加音频 (C#)

转载 作者:太空宇宙 更新时间:2023-11-03 14:58:14 24 4
gpt4 key购买 nike

我想做的是,上传视频后,我想从您可以在创作者工作室中添加的免费音频中将音频添加到视频中。我可以通过编辑视频手动完成并转到音频部分,但我希望软件能够完成。这是我现在将视频上传到 youtube 的代码:

UserCredential credential;
using (var stream = new FileStream("client_id.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows an application to upload files to the
// authenticated user's YouTube channel, but doesn't allow other types of access.
new[] { YouTubeService.Scope.YoutubeUpload },
"user",
CancellationToken.None
);
}

var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
});

var video = new Video();
video.Snippet = new VideoSnippet();
video.Snippet.Title = "title";
video.Snippet.Description = "description";
video.Snippet.Tags = new string[]{"tags"};
video.Snippet.CategoryId = "22";
video.Status = new VideoStatus();
video.Status.PrivacyStatus = "public";
var filePath = "video.avi"

using (var fileStream = new FileStream(filePath, FileMode.Open))
{
var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;

await videosInsertRequest.UploadAsync();
}

我只需要以编程方式将音频添加到从创作者工作室上传的 YouTube。感谢您的帮助。

最佳答案

Youtube API 中没有这样的方法.您可以在 Videos reference 中查看支持的方法.

关于c# - Youtube API 从免费库上传视频和添加音频 (C#),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47782016/

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