fix: 修复场景检测后不进行切分的问题
问题分析: 场景检测成功识别出44个场景,但是没有进行切分。 原因是needs_segmentation方法只检查视频总时长是否超过最大时长限制。 当视频总时长(170.86秒)小于默认限制(300秒)时,即使有场景检测结果也不会切分。 修复方案: 修改切分条件判断逻辑: - 原逻辑:只有当视频总时长 > 最大时长限制时才切分 - 新逻辑:满足以下任一条件即切分: 1. 视频总时长 > 最大时长限制 2. 是视频文件且有场景检测结果 这样确保: 有场景检测结果的视频一定会进行分镜头切分 超长视频即使没有场景检测也会按时长切分 保持原有的时长限制功能 现在有场景检测结果的视频都会正确进行分镜头+二次切分处理!
This commit is contained in:
parent
faeafa41cb
commit
27353e352f
|
|
@ -302,7 +302,14 @@ impl MaterialService {
|
|||
}
|
||||
|
||||
// 3. 检查是否需要切分视频
|
||||
if material.needs_segmentation(config.max_segment_duration) {
|
||||
let should_segment = material.needs_segmentation(config.max_segment_duration) ||
|
||||
(matches!(material.material_type, MaterialType::Video) && material.scene_detection.is_some());
|
||||
|
||||
if should_segment {
|
||||
println!("开始视频切分 - 总时长检查: {}, 场景检测: {}",
|
||||
material.needs_segmentation(config.max_segment_duration),
|
||||
material.scene_detection.is_some());
|
||||
|
||||
match Self::segment_video(repository, &material, config) {
|
||||
Ok(_) => {
|
||||
println!("视频切分完成: {}", material.name);
|
||||
|
|
@ -317,6 +324,8 @@ impl MaterialService {
|
|||
return Err(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("跳过视频切分 - 不满足切分条件");
|
||||
}
|
||||
|
||||
// 标记为完成
|
||||
|
|
|
|||
Loading…
Reference in New Issue