Skip to content

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

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

elextechnico-dotcom wants to merge 1 commit into
browser-use:mainfrom
elextechnico-dotcom:fix/windows-subtitle-path-escaping

Conversation

@elextechnico-dotcom

@elextechnico-dotcom elextechnico-dotcom commented Aug 30, 2026

Copy link
Copy Markdown

Summary

  • On Windows, render.py's subtitle compositing step fails with an ffmpeg error like `Unable to open C:appsprojectedit master.srt` — the drive-letter colon and backslashes get mangled before reaching ffmpeg.
  • Root cause: ffmpeg's own filtergraph parser treats \ as its escape character, so it consumes the path's backslashes before the code's own .replace(":", r"\:") colon-escaping can take effect. A raw Windows path like C:\apps\project\edit\master.srt ends up losing its backslashes and the colon escape never lands where it should, producing a broken path.
  • Fix: normalize to forward slashes first (.replace("\\", "/")), which ffmpeg accepts natively on Windows, before applying the existing colon/quote escaping. This sidesteps the backslash-escaping problem entirely instead of trying to double-escape it.

Found and fixed while using this tool for a real edit session on Windows (verified via a full render with subtitles + overlays, output confirmed correct via ffprobe and visual inspection).

Test plan

  • python -m ast / syntax check on the modified file
  • Full render.py run on Windows with subtitles set in the EDL — subtitle filter now resolves the path correctly and the render completes
  • Verified output video has burned-in subtitles matching the source .srt, correctly timed

Summary by cubic

Fixes subtitle path escaping on Windows in render.py so ffmpeg's filtergraph parser no longer mangles the path and renders complete with correct burned-in subtitles.

Bug Fixes

  • Normalizes Windows paths to forward slashes before applying colon and quote escaping, sidestepping ffmpeg's backslash escape handling.

Written for commit 3ddf20b. Summary will update on new commits.

Review in cubic

ffmpeg's filtergraph parser consumes backslashes as its own escape
character before the code's colon-escaping runs, so a raw Windows path
(C:\apps\...) loses its backslashes and the drive letter's colon
escape never applies ("C:\apps\..." becomes "Capps..."), breaking
the subtitles filter. Converting to forward slashes first avoids the
backslash-escaping problem entirely; ffmpeg accepts forward slashes on
Windows natively.

@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

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.

2 participants