add_subtitles
Add subtitles to videos by burning SRT files onto the video track. Customize font style, color, alignment, and margins for precise subtitle placement. Save the edited video with embedded subtitles.
Instructions
Burns subtitles from an SRT file onto a video, with optional styling.
Args: video_path: Path to the input video file. srt_file_path: Path to the SRT subtitle file. output_video_path: Path to save the video with subtitles. font_style (dict, optional): A dictionary for subtitle styling. Supported keys and example values: - 'font_name': 'Arial' (str) - 'font_size': 24 (int) - 'font_color': 'white' or '&H00FFFFFF' (str, FFmpeg color syntax) - 'outline_color': 'black' or '&H00000000' (str) - 'outline_width': 2 (int) - 'shadow_color': 'black' (str) - 'shadow_offset_x': 1 (int) - 'shadow_offset_y': 1 (int) - 'alignment': 7 (int, ASS alignment - Numpad layout: 1=bottom-left, 7=top-left etc. Default often 2=bottom-center) - 'margin_v': 10 (int, vertical margin from edge, depends on alignment) - 'margin_l': 10 (int, left margin) - 'margin_r': 10 (int, right margin) Default is None, which uses FFmpeg's default subtitle styling.
Returns: A status message indicating success or failure.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
font_style | No | ||
output_video_path | Yes | ||
srt_file_path | Yes | ||
video_path | Yes |