video-use Default Subtitle Settings: Chunking, Case, and Placement
By default, video-use creates 2-word uppercase subtitle chunks that break on punctuation, render in Helvetica 18 Bold with 90px bottom margin, and are overlaid last in the ffmpeg pipeline.
This article breaks down the hard-coded subtitle defaults in the browser-use/video-use repository, explaining how automatic caption generation works when you use the --build-subtitles flag. All settings are defined in helpers/render.py and require no configuration to produce platform-ready captions.
Default Subtitle Chunking Behavior
The chunking algorithm in video-use prioritizes readability and timing precision. In helpers/render.py (lines 44-71), the build_master_srt() function implements a two-word maximum with early termination on punctuation.
Chunk Size and Punctuation Breaks
The default chunk size is 2 words per subtitle cue. However, if a word ends with any punctuation mark in PUNCT_BREAK, the chunk terminates immediately:
PUNCT_BREAK = (".", ",", "!", "?", ";", ":")
# Chunking logic from helpers/render.py
chunks = []
current = []
for w in words_in_seg:
current.append(w)
if len(current) >= 2 or w["text"].endswith(tuple(PUNCT_BREAK)):
chunks.append(current)
current = []
This means a phrase like "Wait, what?" splits into two cues: ["Wait,"] and ["what?"] — not one four-word cue.
Text Case Conversion
All subtitle text is converted to uppercase using Python's str.upper():
text = " ".join(w["text"] for w in chunk).upper()
This happens during SRT generation, before any styling is applied. The uppercase default ensures maximum legibility on mobile screens and social feeds.
Subtitle Placement and Visual Style
The SUB_FORCE_STYLE string in helpers/render.py (lines 51-56) hard-codes the placement and appearance:
SUB_FORCE_STYLE = (
"FontName=Helvetica,FontSize=18,Bold=1,"
"PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,BackColour=&H00000000,"
"BorderStyle=1,Outline=2,Shadow=0,"
"Alignment=2,MarginV=90"
)
| Property | Default Value | Purpose |
|---|---|---|
| Font | Helvetica 18 Bold | Clean, platform-neutral typeface |
| Color | White (&H00FFFFFF) |
Maximum contrast on varied backgrounds |
| Outline | 2px black | Subtle definition without heavy shadow |
| Alignment | 2 | Bottom-center positioning |
| MarginV | 90px | Safe zone above TikTok/IG Reels/YouTube Shorts UI chrome |
The 90px vertical margin is specifically calibrated for vertical video. At typical 9:16 resolutions, this places captions approximately 30% up from the bottom — clear of profile pictures, like buttons, and comment prompts.
Composite Order: Subtitles on Top
In helpers/render.py (lines 38-44), the ffmpeg filter graph appends subtitles last:
filter_parts.append(
f"{current}subtitles='{subs_abs}':force_style='{SUB_FORCE_STYLE}'[outv]"
)
This guarantees that captions render above all video overlays, color grades, and animated elements. The subtitles filter receives the fully composited video stream, ensuring text remains crisp and unobscured.
Using the Default Subtitle Pipeline
To trigger automatic subtitle generation with these defaults:
from helpers.render import build_master_srt
# This creates master.srt with 2-word uppercase chunks
build_master_srt(edl, edit_dir, edit_dir / "master.srt")
Or via command line:
python video_use.py --build-subtitles input.mp4
No additional parameters are required. The function reads the transcript from the EDL (edit decision list), applies the chunking rules, and writes a standard SRT file that the render pipeline consumes.
Customization Notes
These defaults are hard-coded constants in helpers/render.py. To modify behavior, you must edit the source:
- Change
2inlen(current) >= 2to adjust word count - Remove
.upper()to preserve original case - Edit
SUB_FORCE_STYLEfor different fonts, colors, or positioning - Adjust
MarginVfor different aspect ratios or platform requirements
The repository does not expose configuration flags for these values. This design choice ensures consistent output across all renders in a production workflow.
Summary
- Chunking: 2-word maximum, early break on
.,!?;:punctuation - Case: Uppercase via
str.upper()inbuild_master_srt() - Placement: Bottom-center with 90px margin, rendered last in ffmpeg pipeline
- Style: Helvetica 18 Bold, white with 2px black outline
- Source: All defaults defined in
helpers/render.py
Frequently Asked Questions
How do I disable automatic chunking and use full sentences?
You must modify helpers/render.py. Remove or increase the len(current) >= 2 condition and the PUNCT_BREAK check. The current implementation has no runtime flag for sentence-level chunking.
Why is the default margin set to 90 pixels?
The 90px MarginV value positions subtitles in the safe zone for vertical video platforms. According to the video-use source code, this clears interface elements on TikTok, Instagram Reels, and YouTube Shorts without manual adjustment per platform.
Can I change the font without editing the source code?
No. The SUB_FORCE_STYLE string is a module-level constant in helpers/render.py. You must edit this file to change font family, size, color, or positioning. There is no command-line interface for subtitle styling.
Does the uppercase conversion affect non-English languages?
The str.upper() method uses Python's Unicode-aware case mapping. For most Latin and Cyrillic scripts, this works as expected. Complex scripts (Arabic, Devanagari) may not have uppercase forms, in which case the text passes through unchanged.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →