Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

feat(video): add configurable source clip fit mode

Emanuel macOS6dc5aa3dd117
diff --git a/app/models/schema.py b/app/models/schema.py
index aa01b7c2..c4d12e10 100644
--- a/app/models/schema.py
+++ b/app/models/schema.py
@@ -46,6 +46,13 @@ class VideoAspect(str, Enum):
raise ValueError(f"unsupported video aspect: {self}")
+class VideoFitMode(str, Enum):
+ """How source clips with a different aspect ratio fill the output canvas."""
+
+ cover = "cover"
+ contain = "contain"
+
+
_Config = ConfigDict(
arbitrary_types_allowed=True,
# Note: ensure your key names match renamed V2 parameters if needed
@@ -82,6 +89,7 @@ class VideoParams(BaseModel):
video_script: str = "" # Script used to generate the video
video_terms: Optional[str | list] = None # Keywords used to generate the video
video_aspect: Optional[VideoAspect] = VideoAspect.portrait.value
+ video_fit_mode: VideoFitMode = VideoFitMode.cover
video_concat_mode: Optional[VideoConcatMode] = VideoConcatMode.random.value
video_transition_mode: Optional[VideoTransitionMode] = None
video_clip_duration: int = Field(default=5, ge=1)
diff --git a/app/services/task.py b/app/services/task.py
index 16b91f54..b435af4e 100644
--- a/app/services/task.py
+++ b/app/services/task.py
@@ -825,6 +825,7 @@ def generate_final_videos(
video_paths=downloaded_videos,
audio_file=audio_file,
video_aspect=params.video_aspect,
+ video_fit_mode=params.video_fit_mode,
video_concat_mode=video_concat_mode,
video_transition_mode=video_transition_mode,
max_clip_duration=params.video_clip_duration,
diff --git a/app/services/video.py b/app/services/video.py
index a0d43c78..5cfae739 100644
--- a/app/services/video.py
+++ b/app/services/video.py
@@ -1,5 +1,6 @@
import itertools
import io
+import math
import os
import random
import gc
@@ -31,6 +32,7 @@ from app.models.schema import (
MaterialInfo,
VideoAspect,
VideoConcatMode,
+ VideoFitMode,
VideoParams,
VideoTransitionMode,
)
@@ -535,6 +537,67 @@ def get_bgm_file(bgm_type: str = "random", bgm_file: str = ""):
return ""
+def _fit_clip_to_canvas(
+ clip,
+ *,
+ target_width: int,
+ target_height: int,
+ fit_mode: VideoFitMode | str = VideoFitMode.cover,
+):
+ """Resize a clip to an exact canvas using cover/crop or contain/letterbox."""
+ source_width, source_height = (int(value) for value in clip.size)
+ target_width = int(target_width)
+ target_height = int(target_height)
+ if min(source_width, source_height, target_width, target_height) <= 0:
+ raise ValueError(
+ "video dimensions must be positive: "
+ f"source={source_width}x{source_height}, "
+ f"target={target_width}x{target_height}"
+ )
+
+ mode = VideoFitMode(fit_mode)
+ if (source_width, source_height) == (target_width, target_height):
+ return clip
+
+ # Exact aspect-ratio matches do not need either a crop or a background.
+ if source_width * target_height == source_height * target_width:
+ return clip.resized(new_size=(target_width, target_height))
+
+ width_scale = target_width / source_width
+ height_scale = target_height / source_height
+
+ if mode == VideoFitMode.cover:
+ # ceil guarantees the resized clip covers the complete canvas despite
+ # floating-point rounding. Any excess is removed symmetrically.
+ scale_factor = max(width_scale, height_scale)
+ resized_width = max(target_width, math.ceil(source_width * scale_factor))
+ resized_height = max(target_height, math.ceil(source_height * scale_factor))
+ resized_clip = clip.resized(new_size=(resized_width, resized_height))
+ crop_x = max(0, (resized_width - target_width) // 2)
+ crop_y = max(0, (resized_height - target_height) // 2)
+ return resized_clip.cropped(
+ x1=crop_x,
+ y1=crop_y,
+ width=target_width,
+ height=target_height,
+ )
+
+ # contain preserves the legacy behavior: show the complete source frame,
+ # centered over a black canvas when the aspect ratios differ.
+ scale_factor = min(width_scale, height_scale)
+ resized_width = max(1, min(target_width, int(source_width * scale_factor)))
+ resized_height = max(1, min(target_height, int(source_height * scale_factor)))
+ background = ColorClip(
+ size=(target_width, target_height), color=(0, 0, 0)
+ ).with_duration(clip.duration)
+ resized_clip = clip.resized(
+ new_size=(resized_width, resized_height)
+ ).with_position("center")
+ return CompositeVideoClip(
+ [background, resized_clip], size=(target_width, target_height)
+ ).with_duration(clip.duration)
+
+
def combine_videos(
combined_video_path: str,
video_paths: List[str],
@@ -545,6 +608,7 @@ def combine_videos(
max_clip_duration: int = 5,
threads: int = 2,
clip_speed: float = 1.0,
+ video_fit_mode: VideoFitMode = VideoFitMode.cover,
) -> str:
audio_clip = AudioFileClip(audio_file)
try:
@@ -577,6 +641,7 @@ def combine_videos(
output_dir = os.path.dirname(combined_video_path)
aspect = VideoAspect(video_aspect)
+ fit_mode = VideoFitMode(video_fit_mode)
video_width, video_height = aspect.to_resolution()
processed_clips = []
@@ -640,29 +705,26 @@ def combine_videos(
# 浮点误差或异常素材时长的安全兜底,保证最终片段不突破配置上限。
if normalized_clip_speed != 1.0:
clip = clip.with_speed_scaled(normalized_clip_speed)
- clip_duration = clip.duration
- # Not all videos are same size, so we need to resize them
+ # Normalize every source clip before transitions are applied. In cover mode
+ # the clip fills the canvas and the excess edges are cropped; contain keeps
+ # the complete source frame and uses black bars for the unused area.
clip_w, clip_h = clip.size
if clip_w != video_width or clip_h != video_height:
clip_ratio = clip.w / clip.h
video_ratio = video_width / video_height
- logger.debug(f"resizing clip, source: {clip_w}x{clip_h}, ratio: {clip_ratio:.2f}, target: {video_width}x{video_height}, ratio: {video_ratio:.2f}")
-
- if clip_ratio == video_ratio:
- clip = clip.resized(new_size=(video_width, video_height))
- else:
- if clip_ratio > video_ratio:
- scale_factor = video_width / clip_w
- else:
- scale_factor = video_height / clip_h
-
- new_width = int(clip_w * scale_factor)
- new_height = int(clip_h * scale_factor)
-
- background = ColorClip(size=(video_width, video_height), color=(0, 0, 0)).with_duration(clip_duration)
- clip_resized = clip.resized(new_size=(new_width, new_height)).with_position("center")
- clip = CompositeVideoClip([background, clip_resized])
-
+ logger.debug(
+ "resizing clip, "
+ f"source: {clip_w}x{clip_h}, ratio: {clip_ratio:.2f}, "
+ f"target: {video_width}x{video_height}, ratio: {video_ratio:.2f}, "
+ f"fit_mode: {fit_mode.value}"
+ )
+ clip = _fit_clip_to_canvas(
+ clip,
+ target_width=video_width,
+ target_height=video_height,
+ fit_mode=fit_mode,
+ )
+
shuffle_side = random.choice(["left", "right", "top", "bottom"])
if transition_value in (None, VideoTransitionMode.none.value):
clip = clip
diff --git a/cli.py b/cli.py
index 4c18f775..9479dbef 100644
--- a/cli.py
+++ b/cli.py
@@ -140,6 +140,15 @@ def _transition_mode(value: str) -> str | None:
return _TRANSITION_MODE_VALUES[normalized]
+def _video_fit_mode(value: str) -> str:
+ normalized = value.strip().lower()
+ if normalized not in {"cover", "contain"}:
+ raise argparse.ArgumentTypeError(
+ "video-fit-mode must be one of: cover, contain"
+ )
+ return normalized
+
+
def _bgm_type(value: str) -> str:
normalized = value.strip().lower()
if normalized == "none":
@@ -295,6 +304,16 @@ Batch manifests:
default="9:16",
help="output aspect ratio: portrait, landscape, or square",
)
+ video_group.add_argument(
+ "--video-fit-mode",
+ type=_video_fit_mode,
+ choices=["cover", "contain"],
+ default=None,
+ help=(
+ "fit mismatched source clips by filling and center-cropping (cover) "
+ "or preserving the full frame with black bars (contain); default: cover"
+ ),
+ )
video_group.add_argument(
"--video-concat-mode",
choices=["random", "sequential"],
@@ -720,6 +739,7 @@ def build_video_params(args: argparse.Namespace) -> VideoParams:
"paragraph_number",
"video_script_prompt",
"custom_system_prompt",
+ "video_fit_mode",
"video_concat_mode",
"video_transition_mode",
"video_clip_duration",
@@ -749,6 +769,7 @@ def build_video_params(args: argparse.Namespace) -> VideoParams:
# 没有显式传入命令行参数时,使用 WebUI 保存的值。只补充上面尚未由命令行
# 设置的字段;若保存值缺失,则继续沿用 VideoParams 的默认值。
ui_defaults = (
+ ("video_fit_mode", str, _video_fit_mode),
("font_name", str, None),
("text_fore_color", str, _hex_color),
("font_size", int, _positive_int),
diff --git a/config.example.toml b/config.example.toml
index df990bca..f4e95a8d 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -491,6 +491,7 @@ open_task_folder_on_completion = true
# video_concat_mode = "random" # "random" or "sequential"
# video_transition_mode = "None" # "None", "Shuffle", "FadeIn", etc.
# video_aspect_pexels = "9:16" # Stored separately for each video source.
+# video_fit_mode = "cover" # "cover" fills/crops; "contain" adds black bars.
# video_clip_duration = 3
# video_clip_speed = 1.0
# video_count = 1
diff --git a/test/services/test_cli.py b/test/services/test_cli.py
index 99585960..66014519 100644
--- a/test/services/test_cli.py
+++ b/test/services/test_cli.py
@@ -32,6 +32,24 @@ class TestCli(unittest.TestCase):
self.assertEqual(params.voice_name, "zh-CN-XiaoxiaoNeural-Female")
+ def test_video_fit_mode_defaults_to_cover_and_accepts_contain(self):
+ default_params = cli.build_video_params(
+ cli.parse_args(["--video-subject", "test"])
+ )
+ contain_params = cli.build_video_params(
+ cli.parse_args(
+ [
+ "--video-subject",
+ "test",
+ "--video-fit-mode",
+ "contain",
+ ]
+ )
+ )
+
+ self.assertEqual(default_params.video_fit_mode.value, "cover")
+ self.assertEqual(contain_params.video_fit_mode.value, "contain")
+
def test_complete_script_can_replace_video_subject(self):
args = cli.parse_args(["--video-script", "完整的视频文案"])
params = cli.build_video_params(args)
diff --git a/test/services/test_schema.py b/test/services/test_schema.py
index 8e00d1e5..cbde408e 100644
--- a/test/services/test_schema.py
+++ b/test/services/test_schema.py
@@ -6,7 +6,7 @@ from pydantic import ValidationError
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
-from app.models.schema import VideoAspect, VideoParams
+from app.models.schema import VideoAspect, VideoFitMode, VideoParams
class TestVideoAspect(unittest.TestCase):
@@ -21,6 +21,20 @@ class TestVideoAspect(unittest.TestCase):
class TestVideoParams(unittest.TestCase):
+ def test_video_fit_mode_defaults_to_cover_and_validates_values(self):
+ self.assertEqual(
+ VideoParams(video_subject="Coffee").video_fit_mode,
+ VideoFitMode.cover,
+ )
+ self.assertEqual(
+ VideoParams(
+ video_subject="Coffee", video_fit_mode="contain"
+ ).video_fit_mode,
+ VideoFitMode.contain,
+ )
+ with self.assertRaises(ValidationError):
+ VideoParams(video_subject="Coffee", video_fit_mode="stretch")
+
def test_rejects_non_positive_generation_counts(self):
for field_name in ("video_clip_duration", "video_count"):
for value in (0, -1, None):
diff --git a/test/services/test_task.py b/test/services/test_task.py
index 1f5a5151..fd7d7771 100644
--- a/test/services/test_task.py
+++ b/test/services/test_task.py
@@ -90,12 +90,13 @@ class TestTaskService(unittest.TestCase):
custom_system_prompt="Only write short narration.",
)
- def test_generate_final_videos_forwards_clip_speed(self):
- """任务编排层必须把用户选择的画面速度传给视频合成服务。"""
+ def test_generate_final_videos_forwards_clip_speed_and_fit_mode(self):
+ """任务编排层必须把画面速度和适配模式传给视频合成服务。"""
params = VideoParams(
video_subject="test",
video_count=1,
video_clip_speed=1.25,
+ video_fit_mode="contain",
)
with (
@@ -113,6 +114,10 @@ class TestTaskService(unittest.TestCase):
)
self.assertEqual(combine_videos.call_args.kwargs["clip_speed"], 1.25)
+ self.assertEqual(
+ combine_videos.call_args.kwargs["video_fit_mode"],
+ params.video_fit_mode,
+ )
def test_generate_final_videos_uses_generated_sonilo_music(self):
"""Sonilo 必须针对每条拼接后的视频生成配乐,并传给最终混音。"""
diff --git a/test/services/test_video.py b/test/services/test_video.py
index 4c54f899..2176fa1e 100644
--- a/test/services/test_video.py
+++ b/test/services/test_video.py
@@ -63,6 +63,48 @@ class TestVideoService(unittest.TestCase):
vd._runtime_disabled_video_codecs.clear()
vd._ffmpeg_encoder_exists.cache_clear()
+ def test_fit_clip_cover_fills_portrait_canvas_without_black_bars(self):
+ source_color = [17, 34, 51]
+ source = ImageClip(
+ vd.np.full((90, 160, 3), source_color, dtype=vd.np.uint8)
+ ).with_duration(1)
+ fitted = vd._fit_clip_to_canvas(
+ source,
+ target_width=90,
+ target_height=160,
+ fit_mode=vd.VideoFitMode.cover,
+ )
+
+ try:
+ self.assertEqual(tuple(fitted.size), (90, 160))
+ frame = fitted.get_frame(0)
+ self.assertEqual(frame[0, 45].tolist(), source_color)
+ self.assertEqual(frame[-1, 45].tolist(), source_color)
+ finally:
+ vd.close_clip(fitted)
+ vd.close_clip(source)
+
+ def test_fit_clip_contain_preserves_legacy_black_bars(self):
+ source_color = [17, 34, 51]
+ source = ImageClip(
+ vd.np.full((90, 160, 3), source_color, dtype=vd.np.uint8)
+ ).with_duration(1)
+ fitted = vd._fit_clip_to_canvas(
+ source,
+ target_width=90,
+ target_height=160,
+ fit_mode=vd.VideoFitMode.contain,
+ )
+
+ try:
+ self.assertEqual(tuple(fitted.size), (90, 160))
+ frame = fitted.get_frame(0)
+ self.assertEqual(frame[0, 45].tolist(), [0, 0, 0])
+ self.assertEqual(frame[80, 45].tolist(), source_color)
+ finally:
+ vd.close_clip(fitted)
+ vd.close_clip(source)
+
def test_delete_files_deduplicates_paths_and_ignores_missing_files(self):
"""
循环片段会让同一路径在拼接列表中重复出现,清理时每个路径只能删除一次。
diff --git a/test/services/test_webui_generation_defaults.py b/test/services/test_webui_generation_defaults.py
index 31e28b5d..87d15000 100644
--- a/test/services/test_webui_generation_defaults.py
+++ b/test/services/test_webui_generation_defaults.py
@@ -85,6 +85,9 @@ def test_reusable_generation_settings_survive_a_new_webui_session():
_widget_by_key(first_session.selectbox, "video_aspect_for_pexels").set_value(
"16:9"
)
+ _widget_by_key(first_session.selectbox, "video_fit_mode_select").set_value(
+ "contain"
+ )
_widget_by_key(first_session.selectbox, "video_clip_duration_select").set_value(
7
)
@@ -145,6 +148,7 @@ def test_reusable_generation_settings_survive_a_new_webui_session():
"video_transition_mode": "FadeIn",
"video_aspect_pexels": "16:9",
"video_aspect_coverr": "9:16",
+ "video_fit_mode": "contain",
"video_clip_duration": 7,
"video_clip_speed": 1.5,
"video_count": 3,
@@ -191,6 +195,9 @@ def test_reusable_generation_settings_survive_a_new_webui_session():
assert _widget_by_key(
second_session.selectbox, "video_aspect_for_pexels"
).value == "16:9"
+ assert _widget_by_key(
+ second_session.selectbox, "video_fit_mode_select"
+ ).value == "contain"
_widget_by_key(second_session.selectbox, "video_source_select").set_value(
"coverr"
).run()
@@ -283,6 +290,7 @@ def test_invalid_saved_generation_settings_fall_back_without_breaking_webui():
video_concat_mode="not-a-mode",
video_transition_mode="not-a-transition",
video_aspect_pexels="4:3",
+ video_fit_mode="stretch",
video_clip_duration=999,
video_clip_speed="nan",
video_count=True,
@@ -317,6 +325,7 @@ def test_invalid_saved_generation_settings_fall_back_without_breaking_webui():
"None"
)
assert _widget_by_key(app.selectbox, "video_aspect_for_pexels").value == "9:16"
+ assert _widget_by_key(app.selectbox, "video_fit_mode_select").value == "cover"
assert _widget_by_key(app.selectbox, "video_clip_duration_select").value == 3
assert _widget_by_key(app.slider, "video_clip_speed_slider").value == 1.0
assert _widget_by_key(app.selectbox, "video_count_select").value == 1
diff --git a/test/services/test_webui_settings_transfer.py b/test/services/test_webui_settings_transfer.py
index e31e0ee5..2ac98078 100644
--- a/test/services/test_webui_settings_transfer.py
+++ b/test/services/test_webui_settings_transfer.py
@@ -151,6 +151,7 @@ def test_settings_preset_round_trip_preserves_generation_settings():
params = VideoParams(
video_subject="a cat",
video_aspect="9:16",
+ video_fit_mode="contain",
font_size=48,
stroke_width=2.5,
voice_volume=0.8,
@@ -163,6 +164,7 @@ def test_settings_preset_round_trip_preserves_generation_settings():
assert restored["video_subject"] == "a cat"
assert restored["video_aspect"] == "9:16"
+ assert restored["video_fit_mode"] == "contain"
assert restored["font_size"] == 48
assert restored["stroke_width"] == 2.5
assert restored["voice_volume"] == 0.8
diff --git a/webui/Main.py b/webui/Main.py
index 513b7064..c20dddbf 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -39,6 +39,7 @@ from app.models.schema import (
MaterialInfo,
VideoAspect,
VideoConcatMode,
+ VideoFitMode,
VideoParams,
VideoTransitionMode,
)
@@ -1289,6 +1290,10 @@ def _apply_restored_params(params):
f"video_aspect_for_{video_source}",
params.get("video_aspect") or VideoAspect.portrait.value,
)
+ _set_stable_widget_value(
+ "video_fit_mode_select",
+ params.get("video_fit_mode") or VideoFitMode.cover.value,
+ )
_set_stable_widget_value(
"video_clip_duration_select", params.get("video_clip_duration", 3)
)
@@ -3951,6 +3956,29 @@ def _render_video_settings(panel, params):
"ui", video_aspect_config_key, params.video_aspect.value
)
+ video_fit_modes = [
+ (tr("Fill and Crop"), VideoFitMode.cover.value),
+ (tr("Fit with Black Bars"), VideoFitMode.contain.value),
+ ]
+ selected_fit_mode = stable_selectbox(
+ tr("Video Fit Mode"),
+ options=[value for _, value in video_fit_modes],
+ default_value=_saved_ui_choice(
+ "video_fit_mode",
+ [value for _, value in video_fit_modes],
+ VideoFitMode.cover.value,
+ ),
+ key="video_fit_mode_select",
+ format_func=lambda value: dict(
+ (v, label) for label, v in video_fit_modes
+ )[value],
+ help=tr("Video Fit Mode Help"),
+ )
+ params.video_fit_mode = VideoFitMode(selected_fit_mode)
+ _set_runtime_config(
+ "ui", "video_fit_mode", params.video_fit_mode.value
+ )
+
video_clip_durations = [2, 3, 4, 5, 6, 7, 8, 9, 10]
params.video_clip_duration = stable_selectbox(
tr("Clip Duration"),
diff --git a/webui/i18n/de.json b/webui/i18n/de.json
index 1340fe7d..4fd520d0 100644
--- a/webui/i18n/de.json
+++ b/webui/i18n/de.json
@@ -89,6 +89,10 @@
"Video Ratio": "Video-Seitenverhältnis",
"Portrait": "Hochformat 9:16",
"Landscape": "Landschaft 16:9",
+ "Video Fit Mode": "Anpassung des Quellbilds",
+ "Fill and Crop": "Ausfüllen (zentriert zuschneiden)",
+ "Fit with Black Bars": "Einpassen (schwarze Balken)",
+ "Video Fit Mode Help": "Ausfüllen nutzt die gesamte Ausgabefläche und schneidet überstehende Ränder ab. Einpassen erhält das vollständige Quellbild und fügt bei Bedarf schwarze Balken hinzu.",
"Clip Duration": "Max. Dauer pro Clip (Sek.)",
"Clip Duration Help": "Legt die Dauer jedes verwendeten Clips fest, nicht die Gesamtlänge des Videos.",
"Clip Speed": "Clip-Geschwindigkeit",
diff --git a/webui/i18n/en.json b/webui/i18n/en.json
index 56211bbc..4052df75 100644
--- a/webui/i18n/en.json
+++ b/webui/i18n/en.json
@@ -99,6 +99,10 @@
"Video Ratio": "Video Aspect Ratio",
"Portrait": "Portrait 9:16",
"Landscape": "Landscape 16:9",
+ "Video Fit Mode": "Source Frame Fit",
+ "Fill and Crop": "Fill (center crop)",
+ "Fit with Black Bars": "Fit (black bars)",
+ "Video Fit Mode Help": "Fill uses the entire output canvas and crops excess edges. Fit preserves the complete source frame and adds black bars when needed.",
"Clip Duration": "Maximum Clip Duration (seconds)",
"Clip Duration Help": "Controls the duration of each clip used in the composition, not the total video length.",
"Clip Speed": "Clip Speed",
diff --git a/webui/i18n/es.json b/webui/i18n/es.json
index 7f265e36..e278fd83 100644
--- a/webui/i18n/es.json
+++ b/webui/i18n/es.json
@@ -89,6 +89,10 @@
"Video Ratio": "Relación de aspecto del vídeo",
"Portrait": "Vertical 9:16",
"Landscape": "Horizontal 16:9",
+ "Video Fit Mode": "Ajuste del encuadre de origen",
+ "Fill and Crop": "Rellenar (recorte central)",
+ "Fit with Black Bars": "Ajustar (barras negras)",
+ "Video Fit Mode Help": "Rellenar ocupa todo el lienzo de salida y recorta los bordes sobrantes. Ajustar conserva el encuadre completo y añade barras negras cuando sea necesario.",
"Clip Duration": "Duración máxima por clip (s)",
"Clip Duration Help": "Controla la duración de cada clip utilizado, no la duración total del vídeo.",
"Clip Speed": "Velocidad del clip",
diff --git a/webui/i18n/fr.json b/webui/i18n/fr.json
index 6c11897a..afee0798 100644
--- a/webui/i18n/fr.json
+++ b/webui/i18n/fr.json
@@ -89,6 +89,10 @@
"Video Ratio": "Format d'affichage vidéo",
"Portrait": "Portrait 9:16",
"Landscape": "Paysage 16:9",
+ "Video Fit Mode": "Ajustement du cadrage source",
+ "Fill and Crop": "Remplir (recadrage centré)",
+ "Fit with Black Bars": "Ajuster (bandes noires)",
+ "Video Fit Mode Help": "Remplir utilise tout le cadre de sortie et coupe les bords excédentaires. Ajuster conserve l’image source complète et ajoute des bandes noires si nécessaire.",
"Clip Duration": "Durée maximale d'un extrait (secondes)",
"Clip Duration Help": "Contrôle la durée de chaque extrait utilisé dans la composition, et non la durée totale du rendu.",
"Clip Speed": "Vitesse de l'extrait",
diff --git a/webui/i18n/id.json b/webui/i18n/id.json
index 9676f74c..c7b74107 100644
--- a/webui/i18n/id.json
+++ b/webui/i18n/id.json
@@ -89,6 +89,10 @@
"Video Ratio": "Rasio Aspek Video",
"Portrait": "Potret 9:16",
"Landscape": "Lanskap 16:9",
+ "Video Fit Mode": "Penyesuaian Bingkai Sumber",
+ "Fill and Crop": "Penuhi (potong tengah)",
+ "Fit with Black Bars": "Sesuaikan (bilah hitam)",
+ "Video Fit Mode Help": "Penuhi memakai seluruh kanvas keluaran dan memotong tepi berlebih. Sesuaikan mempertahankan bingkai sumber lengkap dan menambahkan bilah hitam bila diperlukan.",
"Clip Duration": "Durasi Maks. per Klip (detik)",
"Clip Duration Help": "Menentukan durasi setiap klip yang digunakan, bukan durasi total video.",
"Clip Speed": "Kecepatan Klip",
diff --git a/webui/i18n/it.json b/webui/i18n/it.json
index e97fb01b..131a3938 100644
--- a/webui/i18n/it.json
+++ b/webui/i18n/it.json
@@ -89,6 +89,10 @@
"Video Ratio": "Proporzioni video",
"Portrait": "Verticale 9:16",
"Landscape": "Orizzontale 16:9",
+ "Video Fit Mode": "Adattamento dell’inquadratura sorgente",
+ "Fill and Crop": "Riempi (ritaglio centrale)",
+ "Fit with Black Bars": "Adatta (bande nere)",
+ "Video Fit Mode Help": "Riempi usa l’intera area di uscita e ritaglia i bordi in eccesso. Adatta conserva l’inquadratura sorgente completa e aggiunge bande nere quando necessario.",
"Clip Duration": "Durata massima per clip (secondi)",
"Clip Duration Help": "Controlla la durata di ciascuna clip utilizzata nella composizione, non la durata totale del video.",
"Clip Speed": "Velocità della clip",
diff --git a/webui/i18n/ko.json b/webui/i18n/ko.json
index 047539c1..c03c71f7 100644
--- a/webui/i18n/ko.json
+++ b/webui/i18n/ko.json
@@ -89,6 +89,10 @@
"Video Ratio": "영상 비율",
"Portrait": "세로 9:16",
"Landscape": "가로 16:9",
+ "Video Fit Mode": "원본 화면 맞춤",
+ "Fill and Crop": "채우기 (가운데 자르기)",
+ "Fit with Black Bars": "맞추기 (검은 여백)",
+ "Video Fit Mode Help": "채우기는 출력 화면 전체를 사용하고 넘치는 가장자리를 자릅니다. 맞추기는 원본 화면 전체를 유지하고 필요할 때 검은 여백을 추가합니다.",
"Clip Duration": "클립 최대 길이 (초)",
"Clip Duration Help": "합성에 사용되는 각 클립의 길이를 조절합니다. 전체 영상 길이가 아닙니다.",
"Clip Speed": "클립 재생 속도",
diff --git a/webui/i18n/pt.json b/webui/i18n/pt.json
index e8115537..9bd73ecd 100644
--- a/webui/i18n/pt.json
+++ b/webui/i18n/pt.json
@@ -89,6 +89,10 @@
"Video Ratio": "Proporção do Vídeo",
"Portrait": "Retrato 9:16",
"Landscape": "Paisagem 16:9",
+ "Video Fit Mode": "Ajuste do enquadramento",
+ "Fill and Crop": "Preencher (recorte central)",
+ "Fit with Black Bars": "Ajustar (barras pretas)",
+ "Video Fit Mode Help": "Preencher ocupa toda a tela e recorta o excesso nas bordas. Ajustar preserva o quadro completo e adiciona barras pretas quando necessário.",
"Clip Duration": "Duração máxima por clipe (s)",
"Clip Duration Help": "Define a duração de cada clipe utilizado, não a duração total do vídeo.",
"Clip Speed": "Velocidade do clipe",
diff --git a/webui/i18n/ru.json b/webui/i18n/ru.json
index 738a3840..98128ddc 100644
--- a/webui/i18n/ru.json
+++ b/webui/i18n/ru.json
@@ -91,6 +91,10 @@
"Video Ratio": "Формат видео",
"Portrait": "Вертикальное 9:16",
"Landscape": "Горизонтальное 16:9",
+ "Video Fit Mode": "Подгонка исходного кадра",
+ "Fill and Crop": "Заполнить (обрезка по центру)",
+ "Fit with Black Bars": "Вместить (чёрные полосы)",
+ "Video Fit Mode Help": "Заполнение использует весь выходной кадр и обрезает лишние края. Вмещение сохраняет исходный кадр целиком и при необходимости добавляет чёрные полосы.",
"Clip Duration": "Макс. длительность фрагмента (сек.)",
"Clip Duration Help": "Определяет длительность каждого используемого фрагмента, а не общую длину видео.",
"Clip Speed": "Скорость фрагментов",
diff --git a/webui/i18n/tr.json b/webui/i18n/tr.json
index ba5c9db6..642c9b37 100644
--- a/webui/i18n/tr.json
+++ b/webui/i18n/tr.json
@@ -89,6 +89,10 @@
"Video Ratio": "Video En-Boy Oranı",
"Portrait": "Dikey 9:16",
"Landscape": "Yatay 16:9",
+ "Video Fit Mode": "Kaynak Kadrajı Sığdırma",
+ "Fill and Crop": "Doldur (ortadan kırp)",
+ "Fit with Black Bars": "Sığdır (siyah çubuklar)",
+ "Video Fit Mode Help": "Doldur, çıkış alanının tamamını kullanır ve taşan kenarları kırpar. Sığdır, kaynak kadrajın tamamını korur ve gerektiğinde siyah çubuklar ekler.",
"Clip Duration": "Maks. Klip Süresi (sn.)",
"Clip Duration Help": "Toplam video süresini değil, kullanılan her klibin süresini belirler.",
"Clip Speed": "Klip Hızı",
diff --git a/webui/i18n/vi.json b/webui/i18n/vi.json
index deea7e9f..07f2c7ea 100644
--- a/webui/i18n/vi.json
+++ b/webui/i18n/vi.json
@@ -89,6 +89,10 @@
"Video Ratio": "Tỷ Lệ Khung Hình Video",
"Portrait": "Dọc 9:16",
"Landscape": "Ngang 16:9",
+ "Video Fit Mode": "Cách khớp khung hình nguồn",
+ "Fill and Crop": "Lấp đầy (cắt giữa)",
+ "Fit with Black Bars": "Vừa khung (viền đen)",
+ "Video Fit Mode Help": "Lấp đầy sử dụng toàn bộ khung đầu ra và cắt phần cạnh dư. Vừa khung giữ nguyên toàn bộ hình nguồn và thêm viền đen khi cần.",
"Clip Duration": "Thời Lượng Tối Đa Mỗi Clip (giây)",
"Clip Duration Help": "Quy định thời lượng của từng clip được sử dụng, không phải tổng thời lượng video.",
"Clip Speed": "Tốc độ clip",
diff --git a/webui/i18n/zh.json b/webui/i18n/zh.json
index 2cb44fca..46e1ed21 100644
--- a/webui/i18n/zh.json
+++ b/webui/i18n/zh.json
@@ -99,6 +99,10 @@
"Video Ratio": "视频比例",
"Portrait": "竖屏 9:16(抖音视频)",
"Landscape": "横屏 16:9(西瓜视频)",
+ "Video Fit Mode": "素材画面适配",
+ "Fill and Crop": "填满(居中裁剪)",
+ "Fit with Black Bars": "完整显示(黑边)",
+ "Video Fit Mode Help": "填满会占满整个输出画面并裁掉多余边缘;完整显示会保留全部素材画面,并在需要时添加黑边。",
"Clip Duration": "单个片段最大时长(秒)",
"Clip Duration Help": "控制合成时使用的每个视频片段时长,不是视频总时长。",
"Clip Speed": "片段播放速度",