How to Configure the Bold-Overlay Subtitle Style for Various Video Types Using video-use
The bold-overlay subtitle style in video-use is controlled by the SUB_FORCE_STYLE constant in helpers/render.py, which defaults to a high-contrast, two-word uppercase format and can be customized by editing the constant or using environment variables to suit different video types.
The browser-use/video-use repository provides a streamlined video rendering pipeline that applies subtitles as a final FFmpeg filter pass. Configuring the bold-overlay subtitle style allows you to maintain consistent readability across different video types while adapting the aesthetic for specific content needs.
Understanding the Bold-Overlay Style
Default Style Characteristics
The default bold-overlay style defined in helpers/render.py produces terse, two-word UPPERCASE captions using Helvetica 18 Bold with a white-on-outline font scheme. This configuration includes a vertical margin of 35 pixels, ensuring subtitles remain legible on mobile screens without obscuring critical video content.
Technical Implementation
According to the source code in helpers/render.py, the style string is passed directly to the FFmpeg subtitles filter via the force_style option. As documented in SKILL.md, this filter operates as the last processing step in the render pipeline, guaranteeing that subtitles appear above all overlays and video effects.
Configuring Subtitle Styles for Different Video Types
Editing the SUB_FORCE_STYLE Constant
To permanently change the subtitle appearance for a specific video category, modify the SUB_FORCE_STYLE constant at the top of helpers/render.py. For example, to create a cinematic documentary style with lower-case text and increased margins:
# helpers/render.py
SUB_FORCE_STYLE = (
"FontName=Arial,FontSize=24,"
"PrimaryColour=&H00FFFFFF&,OutlineColour=&H00000000&,"
"BorderStyle=1,MarginV=50,Bold=0,Italic=0"
)
Using Environment Variables for Runtime Overrides
For temporary style changes without modifying source code, patch helpers/render.py to read from an environment variable:
import os
SUB_FORCE_STYLE = os.getenv("VIDEO_USE_SUB_STYLE", "bold-overlay")
Then invoke the renderer with a custom style for specific video types:
VIDEO_USE_SUB_STYLE="FontName=Times,FontSize=22,PrimaryColour=&H00FFCC00&,MarginV=40" \
python helpers/render.py edl.json -o output.mp4 --build-subtitles
Creating Video-Type-Specific EDLs
Edit-decision-list (EDL) files allow you to route different video types through the same rendering pipeline while using distinct subtitle sources. The helpers/transcribe.py module generates .srt files that feed into this pipeline. Since helpers/render.py applies the global SUB_FORCE_STYLE to whichever .srt file the EDL references, you can maintain separate EDLs for tutorials, promos, and documentaries while customizing the style constant between batch jobs.
CLI Commands for Subtitle Rendering
The render.py script accepts several flags to control subtitle generation:
--build-subtitles: Generates a master subtitle file from transcriptions and applies the configured style--no-subtitles: Skips subtitle processing entirely- Omitting both flags: Uses existing subtitle files without rebuilding
Example workflow for a tutorial video:
# Build subtitles with custom style (set via env var or edited constant)
python helpers/render.py tutorial_edl.json -o tutorial.mp4 --build-subtitles
Example for a final export without captions:
python helpers/render.py final_edl.json -o final.mp4 --no-subtitles
Verifying Subtitle Placement
After rendering, use helpers/timeline_view.py to visualize the final output and confirm that the bold-overlay style appears correctly above video content without obstruction.
Summary
- The bold-overlay style is defined by the
SUB_FORCE_STYLEconstant inhelpers/render.py - By default, it uses Helvetica 18 Bold, white text with black outline, and 35px vertical margins
- Subtitles are always applied last in the FFmpeg pipeline, as enforced by hard rule 1 in
SKILL.md - Customize styles by editing the constant, using environment variables, or maintaining separate EDL files for different video types
- Use
--build-subtitlesto generate captions from transcriptions or--no-subtitlesto disable them
Frequently Asked Questions
What is the default bold-overlay style in video-use?
The default style specified in helpers/render.py uses a two-word, uppercase format with Helvetica 18 Bold font, white primary color, black outline, and 35-pixel vertical margins. This creates high-contrast captions optimized for quick readability on mobile devices.
How do I change the subtitle font for tutorial videos?
Edit the SUB_FORCE_STYLE constant in helpers/render.py to specify your desired font properties, or set the VIDEO_USE_SUB_STYLE environment variable if you have patched the file to support runtime overrides. For tutorial content, consider reducing font size and switching to sentence case for a softer aesthetic.
Can I disable subtitles entirely when rendering?
Yes. Pass the --no-subtitles flag to helpers/render.py to skip subtitle processing completely. This is useful for generating clean preview versions or when final captions will be added in post-production.
Why are subtitles applied last in the FFmpeg pipeline?
According to SKILL.md, subtitles must be the final filter operation to ensure they appear above all video overlays and effects. This hard rule prevents graphical elements from obscuring text, maintaining accessibility and readability as defined by the SUB_FORCE_STYLE configuration.
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 →