feat: fix ffmpeg bug
This commit is contained in:
parent
ffb226fe73
commit
44f0b399ec
File diff suppressed because it is too large
Load Diff
|
|
@ -1704,6 +1704,30 @@ impl TopazTemplateManager {
|
|||
format!("tvai_up=model={}:scale=0", model)
|
||||
};
|
||||
|
||||
// Add specific resolution for aspect ratio conversion
|
||||
println!("Debug: Checking aspect ratio conversion conditions:");
|
||||
println!("Debug: template.name = '{}'", template.name);
|
||||
println!("Debug: template.settings.output.out_size_method = {}", template.settings.output.out_size_method);
|
||||
println!("Debug: template.settings.output.lock_aspect_ratio = {:?}", template.settings.output.lock_aspect_ratio);
|
||||
|
||||
if template.settings.output.out_size_method == 7 && !template.settings.output.lock_aspect_ratio.unwrap_or(true) {
|
||||
println!("Debug: Aspect ratio conversion conditions met!");
|
||||
// For aspect ratio conversion templates, add specific resolution
|
||||
if template.name.contains("16:9转9:16") {
|
||||
// Convert 16:9 to 9:16 - typical mobile format
|
||||
println!("Debug: Adding 16:9 to 9:16 conversion parameters");
|
||||
tvai_filter.push_str(":w=1080:h=1920");
|
||||
} else if template.name.contains("9:16转16:9") {
|
||||
// Convert 9:16 to 16:9 - typical desktop format
|
||||
println!("Debug: Adding 9:16 to 16:9 conversion parameters");
|
||||
tvai_filter.push_str(":w=1920:h=1080");
|
||||
} else {
|
||||
println!("Debug: Template name doesn't match aspect ratio patterns");
|
||||
}
|
||||
} else {
|
||||
println!("Debug: Aspect ratio conversion conditions NOT met");
|
||||
}
|
||||
|
||||
// Add blend ratio
|
||||
if let Some(blend) = opts.blend_ratio {
|
||||
tvai_filter.push_str(&format!(":blend={}", blend));
|
||||
|
|
@ -2161,6 +2185,8 @@ impl BuiltinTemplates {
|
|||
templates.insert("minidv_hd_int_basic".to_string(), Self::minidv_hd_int_basic());
|
||||
templates.insert("upscale_to_fhd".to_string(), Self::upscale_to_fhd());
|
||||
templates.insert("upscale_4k_convert_60fps".to_string(), Self::upscale_4k_convert_60fps());
|
||||
templates.insert("aspect_ratio_16_9_to_9_16".to_string(), Self::aspect_ratio_16_9_to_9_16());
|
||||
templates.insert("aspect_ratio_9_16_to_16_9".to_string(), Self::aspect_ratio_9_16_to_16_9());
|
||||
|
||||
templates
|
||||
}
|
||||
|
|
@ -2554,6 +2580,158 @@ impl BuiltinTemplates {
|
|||
template.settings.output.out_fps = 60;
|
||||
template
|
||||
}
|
||||
|
||||
/// 16:9 转 9:16 宽高比转换模板
|
||||
pub fn aspect_ratio_16_9_to_9_16() -> TopazTemplate {
|
||||
TopazTemplate {
|
||||
name: "16:9转9:16".to_string(),
|
||||
description: "将16:9横屏视频转换为9:16竖屏格式,适用于短视频平台".to_string(),
|
||||
author: "Topaz Video AI".to_string(),
|
||||
save_output_settings: false,
|
||||
date: "2025-08-18".to_string(),
|
||||
veaiversion: "5.0.0".to_string(),
|
||||
editable: true,
|
||||
enabled: true,
|
||||
path: None,
|
||||
settings: TopazSettings {
|
||||
stabilize: StabilizeSettings {
|
||||
active: false,
|
||||
smooth: 50,
|
||||
method: 1, // 无裁剪
|
||||
rsc: false,
|
||||
reduce_motion: false,
|
||||
reduce_motion_iteration: 2,
|
||||
},
|
||||
motionblur: MotionBlurSettings {
|
||||
active: false,
|
||||
model: "thm-2".to_string(),
|
||||
model_name: Some("thm-2".to_string()),
|
||||
},
|
||||
slowmo: SlowMotionSettings {
|
||||
active: false,
|
||||
model: "apo-8".to_string(),
|
||||
factor: 1,
|
||||
duplicate: false,
|
||||
duplicate_threshold: 10,
|
||||
},
|
||||
enhance: EnhanceSettings {
|
||||
active: true,
|
||||
model: "prob-4".to_string(), // 高质量增强模型
|
||||
video_type: 1, // 逐行扫描
|
||||
auto: 0,
|
||||
field_order: 0,
|
||||
compress: 0,
|
||||
detail: 0,
|
||||
sharpen: 0,
|
||||
denoise: 0,
|
||||
dehalo: 0,
|
||||
deblur: 0,
|
||||
add_noise: 0,
|
||||
recover_original_detail_value: 20,
|
||||
focus_fix_level: Some("Standard".to_string()),
|
||||
is_artemis: false,
|
||||
is_gaia: false,
|
||||
is_theia: false,
|
||||
is_proteus: false,
|
||||
is_iris: false,
|
||||
is_second_enhancement: Some(false),
|
||||
},
|
||||
grain: GrainSettings {
|
||||
active: false,
|
||||
grain: 0,
|
||||
grain_size: 2,
|
||||
},
|
||||
output: OutputSettings {
|
||||
active: true,
|
||||
out_size_method: 7, // 自定义尺寸
|
||||
crop_to_fit: true, // 裁剪适应
|
||||
output_par: 0,
|
||||
out_fps: 0, // 保持原始帧率
|
||||
custom_resolution_priority: Some(2),
|
||||
lock_aspect_ratio: Some(false), // 允许改变宽高比
|
||||
},
|
||||
hdr: None,
|
||||
second_enhance: None,
|
||||
filter_manager: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// 9:16 转 16:9 宽高比转换模板
|
||||
pub fn aspect_ratio_9_16_to_16_9() -> TopazTemplate {
|
||||
TopazTemplate {
|
||||
name: "9:16转16:9".to_string(),
|
||||
description: "将9:16竖屏视频转换为16:9横屏格式,适用于电视和电脑播放".to_string(),
|
||||
author: "Topaz Video AI".to_string(),
|
||||
save_output_settings: false,
|
||||
date: "2025-08-18".to_string(),
|
||||
veaiversion: "5.0.0".to_string(),
|
||||
editable: true,
|
||||
enabled: true,
|
||||
path: None,
|
||||
settings: TopazSettings {
|
||||
stabilize: StabilizeSettings {
|
||||
active: false,
|
||||
smooth: 50,
|
||||
method: 1, // 无裁剪
|
||||
rsc: false,
|
||||
reduce_motion: false,
|
||||
reduce_motion_iteration: 2,
|
||||
},
|
||||
motionblur: MotionBlurSettings {
|
||||
active: false,
|
||||
model: "thm-2".to_string(),
|
||||
model_name: Some("thm-2".to_string()),
|
||||
},
|
||||
slowmo: SlowMotionSettings {
|
||||
active: false,
|
||||
model: "apo-8".to_string(),
|
||||
factor: 1,
|
||||
duplicate: false,
|
||||
duplicate_threshold: 10,
|
||||
},
|
||||
enhance: EnhanceSettings {
|
||||
active: true,
|
||||
model: "prob-4".to_string(), // 高质量增强模型
|
||||
video_type: 1, // 逐行扫描
|
||||
auto: 0,
|
||||
field_order: 0,
|
||||
compress: 0,
|
||||
detail: 0,
|
||||
sharpen: 0,
|
||||
denoise: 0,
|
||||
dehalo: 0,
|
||||
deblur: 0,
|
||||
add_noise: 0,
|
||||
recover_original_detail_value: 20,
|
||||
focus_fix_level: Some("Standard".to_string()),
|
||||
is_artemis: false,
|
||||
is_gaia: false,
|
||||
is_theia: false,
|
||||
is_proteus: false,
|
||||
is_iris: false,
|
||||
is_second_enhancement: Some(false),
|
||||
},
|
||||
grain: GrainSettings {
|
||||
active: false,
|
||||
grain: 0,
|
||||
grain_size: 2,
|
||||
},
|
||||
output: OutputSettings {
|
||||
active: true,
|
||||
out_size_method: 7, // 自定义尺寸
|
||||
crop_to_fit: true, // 裁剪适应
|
||||
output_par: 0,
|
||||
out_fps: 0, // 保持原始帧率
|
||||
custom_resolution_priority: Some(2),
|
||||
lock_aspect_ratio: Some(false), // 允许改变宽高比
|
||||
},
|
||||
hdr: None,
|
||||
second_enhance: None,
|
||||
filter_manager: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Implement Default for all settings structs
|
||||
|
|
|
|||
|
|
@ -157,7 +157,9 @@ impl WebApi {
|
|||
"film_stock_4k_strong",
|
||||
"minidv_hd_int_basic",
|
||||
"upscale_to_fhd",
|
||||
"upscale_4k_convert_60fps"
|
||||
"upscale_4k_convert_60fps",
|
||||
"aspect_ratio_16_9_to_9_16",
|
||||
"aspect_ratio_9_16_to_16_9"
|
||||
];
|
||||
|
||||
for name in &template_names {
|
||||
|
|
|
|||
Loading…
Reference in New Issue