Skip to content

Fix subtitles filter path escaping on Windows - #124

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

Fix subtitles filter path escaping on Windows#124
samlwg76 wants to merge 1 commit into
browser-use:mainfrom
samlwg76:fix/windows-subtitle-path-escaping

Conversation

@samlwg76

@samlwg76 samlwg76 commented Aug 9, 2026

Copy link
Copy Markdown

Problem

On Windows, every render that burns subtitles fails:

[Parsed_subtitles_0 @ ...] Unable to open C:UsersmeprojecteditmasterFsrt
[AVFilterGraph @ ...] Error initializing filters
Error : No such file or directory

Repro: python helpers/render.py edit/edl.json -o final.mp4 --build-subtitles on Windows. Segment extraction, concat and SRT generation all succeed; the failure is in the final composite pass.

Cause

build_final_composite escapes the drive colon but leaves the Windows path separators alone:

subs_abs = str(subtitles_path.resolve()).replace(":", r"\:").replace("'", r"\'")

ffmpeg's filtergraph parser treats \ as an escape character, so the backslashes are consumed before the subtitles filter ever sees them. C:\Users\me\edit\master.srt arrives as C:Usersmeeditmaster.srt.

Fix

Convert to forward slashes before escaping the colon. ffmpeg accepts forward slashes in filter paths on Windows, and the added replace is a no-op on POSIX, where the path contains no backslashes to begin with.

Testing

  • Windows 11, ffmpeg 8.1.1, Python 3.12 — --build-subtitles now renders end to end: 7 cues burned into a 1920x1080 final.mp4, loudnorm pass included. Verified the escaped filtergraph string opens the file by running the generated ffmpeg command directly both before and after the change.
  • The change is string-level and platform-agnostic; on POSIX str(Path.resolve()) yields no backslashes, so the behaviour is byte-identical to before.

Summary by cubic

Fixes subtitle burn-in failures on Windows by normalizing subtitle paths in the final composite filtergraph. Backslashes are converted to forward slashes before escaping the drive colon and quotes, so ffmpeg reads the SRT path correctly; POSIX is unaffected.

Written for commit 75d6b76. Summary will update on new commits.

Review in cubic

The subtitles path escapes the drive colon but leaves Windows backslashes
intact. ffmpeg's filtergraph parser treats "\" as an escape character, so
C:\Users\me\edit\master.srt reaches the filter as C:Usersmeeditmaster.srt
and every subtitled render fails with "Unable to open ...".

Convert to forward slashes before escaping the colon. ffmpeg accepts
forward slashes in filter paths on Windows, and the replace is a no-op on
POSIX, where paths contain no backslashes to begin with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@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.

1 participant