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