【发布时间】:2018-05-26 16:38:09
【问题描述】:
我想做的是,上传视频后, 我想从您可以在创作者工作室中添加的免费音频中将音频添加到视频中。 我可以通过编辑视频并转到音频部分来手动完成,但我希望软件能够做到这一点。 这是我现在将视频上传到 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。 感谢您的帮助。
【问题讨论】:
标签: c# audio youtube-api youtube-data-api