Fix subtitle path escaping on Windows in render.py - #139
Open
elextechnico-dotcom wants to merge 1 commit into
Open
elextechnico-dotcom wants to merge 1 commit into
elextechnico-dotcom wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.\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 likeC:\apps\project\edit\master.srtends up losing its backslashes and the colon escape never lands where it should, producing a broken path..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 filerender.pyrun on Windows withsubtitlesset in the EDL — subtitle filter now resolves the path correctly and the render completes.srt, correctly timedSummary by cubic
Fixes subtitle path escaping on Windows in
render.pyso ffmpeg's filtergraph parser no longer mangles the path and renders complete with correct burned-in subtitles.Bug Fixes
Written for commit 3ddf20b. Summary will update on new commits.