diff --git a/mcp_video_editor/server.py b/mcp_video_editor/server.py index 4b84d38..0f72703 100644 --- a/mcp_video_editor/server.py +++ b/mcp_video_editor/server.py @@ -359,27 +359,20 @@ def mcp_video_add_overlay( with VideoFileClip(input_path) as clip: if overlay_type == "text" and text: - # Default style - default_style = {"fontsize": 50, "color": "white", "font": "Arial-Bold"} + # Default style (corrected parameter names) + default_style = {"font_size": 50, "color": "white"} if style: default_style.update(style) - # Create text clip - txt_clip = ( - TextClip( - text, - fontsize=default_style["fontsize"], - color=default_style["color"], - font=default_style["font"], - ) - .set_position(position) - .set_start(start_time) - ) + # Create text clip with correct syntax + txt_clip = TextClip( + text=text, + font_size=default_style["font_size"], + color=default_style["color"], + duration=duration or (clip.duration - start_time) + ).with_position(position).with_start(start_time) - if duration: - txt_clip = txt_clip.set_duration(duration) - else: - txt_clip = txt_clip.set_duration(clip.duration - start_time) + # Duration is already set in TextClip constructor # Composite video with text overlay final_clip = CompositeVideoClip([clip, txt_clip])