parent
ac7ec56997
commit
d1bbce8baf
|
|
@ -18,7 +18,6 @@ namespace Learn.VideoAnalysis.API.Expand
|
|||
|
||||
Console.WriteLine($"{DateTime.Now}=>初始化 Coravel");
|
||||
service.AddScheduler();
|
||||
service.AddTransient<NodeSubscriptionJob>();
|
||||
service.AddTransient<TaskFileClearJob>();
|
||||
service.AddTransient<NodePackageJob>();
|
||||
}
|
||||
|
|
@ -26,8 +25,6 @@ namespace Learn.VideoAnalysis.API.Expand
|
|||
{
|
||||
provider.ApplicationServices.UseScheduler(scheduler =>
|
||||
{
|
||||
//每5分钟执行一次 未处理视频扫描
|
||||
scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes();
|
||||
//文件包分析
|
||||
scheduler.Schedule<NodePackageJob>().EveryThirtyMinutes(); //每30分钟执行一次
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Learn.VideoAnalysis.Expand
|
|||
|
||||
Console.WriteLine($"{DateTime.Now}=>初始化 Coravel");
|
||||
service.AddScheduler();
|
||||
service.AddTransient<NodeSubscriptionJob>();
|
||||
service.AddTransient<TaskFileClearJob>();
|
||||
service.AddTransient<NodePackageJob>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace VideoAnalysisCore.AICore.FFMPGE
|
|||
var taskID = long.Parse(task);
|
||||
//间隔秒
|
||||
var intervalSec = 5;
|
||||
var threshold = 15.0;
|
||||
var threshold = 8.15;
|
||||
var PPTVideoCode = await DbScoped.Sugar
|
||||
.Queryable<VideoTask>()
|
||||
.Where(s => s.Id == long.Parse(task))
|
||||
|
|
@ -83,8 +83,11 @@ namespace VideoAnalysisCore.AICore.FFMPGE
|
|||
keyFrames.Add((int)timestamp);
|
||||
//string outputPath = Path.Combine(outputDir, $"change_{timestamp:0000}.jpg");
|
||||
//currFrame.Save(outputPath);
|
||||
//Console.WriteLine($"变化帧: {timestamp}秒,差异值: {diff:F2}");
|
||||
Console.WriteLine($"变化帧: {timestamp}秒,差异值: {diff:F2}");
|
||||
}
|
||||
else
|
||||
Console.WriteLine($"帧: {timestamp}秒,差异值: {diff:F2}");
|
||||
|
||||
}
|
||||
prevFrame?.Dispose();
|
||||
prevFrame = currFrame.Clone();
|
||||
|
|
@ -93,7 +96,7 @@ namespace VideoAnalysisCore.AICore.FFMPGE
|
|||
// 遍历数组
|
||||
for (int i = 1; i < keyFrames.Count(); i++)
|
||||
{
|
||||
keyFrames[i] += 10;//ppt与课堂视频时间修正
|
||||
keyFrames[i] += 5;//ppt与课堂视频时间修正
|
||||
if (keyFrames[i] - keyFrames[i - 1] < 10)
|
||||
keyFrames[i] = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
|||
if (!chatResp.IsSuccessStatusCode)
|
||||
{
|
||||
Console.WriteLine(DateTime.Now + "=>请求GPT服务器异常 " + chatResp?.StatusCode);
|
||||
Console.WriteLine(await chatResp.Content.ReadAsStringAsync());
|
||||
goto PostJsonStream;
|
||||
}
|
||||
using var stream = chatResp.Content.ReadAsStream();
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
|||
var fileNameInfoRes = await ChatAsync<FileNameInfo>
|
||||
(task, fileNamePostMessages, null);
|
||||
#if DEBUG
|
||||
fileNameInfoRes = new FileNameInfo() { 授课章节 = "一元二次不等式" };
|
||||
//fileNameInfoRes = new FileNameInfo() { 授课章节 = "一元二次不等式" };
|
||||
#endif
|
||||
var captions = ExpandFunction.GetSpeakerCaptions(captionsArr, speakerArr);
|
||||
var maxVideoTime = captions?.TimeBase?.LastOrDefault()?.End ?? 0;
|
||||
|
|
@ -547,8 +547,8 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
|||
|
||||
}
|
||||
}
|
||||
if (questionRes.Count == 0) continue;
|
||||
questionRes = questionRes.OrderBy(s => s.StartTime).ToList();
|
||||
|
||||
var thems = JsonSerializer.Serialize(questionRes.Adapt<VideoKnowQueryDto[]>());// string.Join(',', questionRes.Select(s => s.StartTime + "->" + s.Theme));
|
||||
var checkResFormat1 = """[{"StartTime":开始秒(number),"KnowPoint":知识点名称(string),"KnowPointId":知识点Id(string)}]""";
|
||||
var knowMessages =
|
||||
|
|
@ -647,7 +647,6 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
|||
|
||||
public async Task<T> ChatAsync<T>(string task, string postMessages, string postMessages1, string model = "deepseek-reasoner")
|
||||
{
|
||||
var maxTokens = 6000;
|
||||
Message[] messageArr = [
|
||||
new Message(postMessages,"user"),
|
||||
string.IsNullOrEmpty(postMessages1)?null:new Message(postMessages1,"user"),
|
||||
|
|
@ -658,7 +657,6 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
|||
taskId = task,
|
||||
model = model,
|
||||
stream = model == "deepseek-reasoner",
|
||||
max_tokens = maxTokens,
|
||||
temperature = 0.2f,
|
||||
messages = messageArr
|
||||
};
|
||||
|
|
|
|||
|
|
@ -180,16 +180,22 @@ namespace VideoAnalysisCore.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
var videoInfo = await vodClient.GetPlayInfoAsync(new AlibabaCloud.SDK.Vod20170321.Models.GetPlayInfoRequest()
|
||||
var url = string.Empty;
|
||||
if (taskInfo.PPTVideoCode.Contains("http"))
|
||||
url = taskInfo.PPTVideoCode;
|
||||
else
|
||||
{
|
||||
VideoId = taskInfo.PPTVideoCode,
|
||||
Formats = "mp4",
|
||||
OutputType = "cdn",
|
||||
AuthTimeout = 3600 * 24 * 12,
|
||||
});
|
||||
if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
|
||||
throw new Exception($"{DateTime.Now} 视频订阅=>获取阿里云视频信息失败 VideoCode {taskInfo.TagId} StatusCode {videoInfo?.StatusCode}");
|
||||
var url = videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL;
|
||||
var videoInfo = await vodClient.GetPlayInfoAsync(new AlibabaCloud.SDK.Vod20170321.Models.GetPlayInfoRequest()
|
||||
{
|
||||
VideoId = taskInfo.PPTVideoCode,
|
||||
Formats = "mp4",
|
||||
OutputType = "cdn",
|
||||
AuthTimeout = 3600 * 24 * 12,
|
||||
});
|
||||
if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
|
||||
throw new Exception($"{DateTime.Now} 视频订阅=>获取阿里云视频信息失败 VideoCode {taskInfo.TagId} StatusCode {videoInfo?.StatusCode}");
|
||||
url = videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL;
|
||||
}
|
||||
await Download(url, localPath, "ppt.mp4",
|
||||
(s, e) => RedisExpand.SetTaskProgress(task, "PPT->" + Math.Round(e.ProgressPercentage, 1)
|
||||
));
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace VideoAnalysisCore.Controllers
|
|||
/// <param name="req">ÇëÇóÌå</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(Name = "NodePackage")]
|
||||
[NonAction, Obsolete]
|
||||
public async Task<IActionResult> NodePackage(NodePackageReq req)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now} Îļþ°ü¶©ÔÄÇëÇó req=" + JsonSerializer.Serialize(req));
|
||||
|
|
@ -112,7 +113,7 @@ namespace VideoAnalysisCore.Controllers
|
|||
TagId = s.VideoCode,
|
||||
MediaUrl = string.Empty,
|
||||
MediaName = s.VideoName,
|
||||
PPTVideoCode = req.AnalyzeItems
|
||||
PPTVideoCode = req.AnalyzeItems //»ñÈ¡ppt videoCode
|
||||
.FirstOrDefault(x => x.AttachmentsInfoType == AttachmentsInfoType.PPT && s.StructurePageContentId == x.StructurePageContentId)
|
||||
?.VideoCode,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue