Fix subtitles filter path escaping on Windows - #124
Open
samlwg76 wants to merge 1 commit into
Open
Conversation
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>
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.
Problem
On Windows, every render that burns subtitles fails:
Repro:
python helpers/render.py edit/edl.json -o final.mp4 --build-subtitleson Windows. Segment extraction, concat and SRT generation all succeed; the failure is in the final composite pass.Cause
build_final_compositeescapes the drive colon but leaves the Windows path separators alone:ffmpeg's filtergraph parser treats
\as an escape character, so the backslashes are consumed before thesubtitlesfilter ever sees them.C:\Users\me\edit\master.srtarrives asC:Usersmeeditmaster.srt.Fix
Convert to forward slashes before escaping the colon. ffmpeg accepts forward slashes in filter paths on Windows, and the added
replaceis a no-op on POSIX, where the path contains no backslashes to begin with.Testing
--build-subtitlesnow renders end to end: 7 cues burned into a 1920x1080final.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.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.