Skip to content

Fix subtitle path escaping on Windows in render.py - #128

Open
flavioengenharia04-cloud wants to merge 1 commit into
browser-use:mainfrom
flavioengenharia04-cloud:fix/windows-subtitle-path-escaping
Open

Fix subtitle path escaping on Windows in render.py#128
flavioengenharia04-cloud wants to merge 1 commit into
browser-use:mainfrom
flavioengenharia04-cloud:fix/windows-subtitle-path-escaping

Conversation

@flavioengenharia04-cloud

@flavioengenharia04-cloud flavioengenharia04-cloud commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • On Windows, build_final_composite's subtitles filter only escaped colons in the SRT path, leaving raw backslashes (e.g. C:\Users\...\master.srt) unescaped.
  • ffmpeg's filtergraph parser treats backslash as an escape character too, so the resulting subtitles='...' filter string was malformed and the render failed with a non-zero exit whenever --build-subtitles (or any EDL with a subtitles path) was used on Windows.
  • Fix: convert backslashes to forward slashes before escaping the drive-letter colon. ffmpeg's subtitles filter accepts forward slashes on Windows, which sidesteps the double-escaping problem entirely.

Test plan

  • Reproduced the failure on Windows running render.py --build-subtitles against a Windows absolute path EDL — composite step failed with a CalledProcessError from the subtitles= filter.
  • Applied the fix and re-ran the same render end-to-end (5 separate EDLs, single and multi-segment) — subtitles composited correctly, no errors.
  • Not tested on macOS/Linux (change is a no-op there since paths never contain backslashes).

🤖 Generated with Claude Code


Summary by cubic

Fix Windows subtitle path escaping in the ffmpeg filter to stop renders from failing when using --build-subtitles or EDL subtitles.

  • Bug Fixes
    • Replace backslashes with forward slashes before escaping the drive-letter colon and quotes in the subtitles path so ffmpeg parses it correctly on Windows.

Written for commit 5e9c4f7. Summary will update on new commits.

Review in cubic

The subtitles filter only escaped colons in the SRT path, leaving raw
backslashes from Windows absolute paths (e.g. C:\Users\...\master.srt)
unescaped. ffmpeg's filtergraph parser treats backslash as an escape
character too, so the resulting filter string was malformed and
build_final_composite failed whenever subtitles were requested on
Windows. Convert backslashes to forward slashes before escaping the
drive-letter colon, which ffmpeg's subtitles filter accepts on Windows
and avoids the double-escaping problem entirely.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

DarkStyleee added a commit to DarkStyleee/video-use that referenced this pull request Aug 20, 2026
…font on Windows

Three small Windows failures, none of them covered by browser-use#131 or browser-use#128.

grade.py passed a temp file path straight into metadata=print:file=. Inside a
filter option value the drive colon reads as an option separator, so ffmpeg
reports "No option name near 'UsersRunner...'" and the analysis dies before a
single frame is sampled. The path is now escaped the way render.py already
escapes the subtitles path. Verified with --analyze on a real capture: the
filter it computes is byte-identical to the one from a run where the path
parses.

render.py and timeline_view.py read the transcript and the EDL with read_text(),
which decodes with the locale codepage. This does not raise on a non-ASCII
transcript, which would at least be visible. On cp1251 it returns mojibake:
"привет" comes back as "Рїсђрёрірес‚", and the subtitles are built from that.
Both files are JSON, so UTF-8 is the only correct decoding.

FONT_CANDIDATES listed macOS and Linux paths only. load_font falls back to
ImageFont.load_default(), so the timeline still renders, in a bitmap font at a
fixed size. Consolas and Arial appended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant