【发布时间】:2018-04-11 23:20:38
【问题描述】:
我正在尝试使用 c# 上传视频,上传本身可以工作但是
视频总是太短(例如,2:14 的视频在 youtube 上变成了 00:29 的视频,00:45 的视频变成了 00:05 的视频)。
上传期间我没有收到错误消息或异常
这是我正在使用的代码
UserCredential credential;
ClientSecrets secrets = new ClientSecrets();
secrets.ClientId = "clientid";
secrets.ClientSecret = "clientsecret";
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
secrets,
new[] { YouTubeService.Scope.YoutubeUpload },
"username",
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 = "Default Video Title";
video.Snippet.Description = "Default Video Description";
video.Snippet.Tags = new string[] { "tag1", "tag2" };
video.Snippet.CategoryId = "22";
video.Status = new VideoStatus();
video.Status.PrivacyStatus = "public";
var filePath = @"filepath";
using (var fileStream = new FileStream(filePath, FileMode.Open))
{
var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet, status", fileStream, "video/mp4");
videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
videosInsertRequest.Upload();
}
To 代码来源于一个 google-api 示例
【问题讨论】:
-
听起来您上传的视频的帧率变化不定或非常低。您是否还可以发布有关您正在上传的视频的一些信息,例如mediainfo 的输出?
-
当然,持续时间:02:14;比特率:1300kb; fps: 29. 你还需要什么?
-
你可能已经知道你是否有恒定的帧率......但无论如何我在保持沉默之前问:mediainfo告诉你帧率模式和FrameRate_Mode_Original - 你可以发布一个链接到你的上传视频?
-
抱歉,我在哪里可以找到 Mediainfo?
-
很抱歉,我一直认为任何处理视频内容的人都知道:mediaarea.net/en/MediaInfo/Download
标签: c# video youtube google-api youtube-api