Skip to content

Escape the captions file name in the subtitles filter - #236

Draft
Andretuta wants to merge 2 commits into
ColinGPT9:mainfrom
Andretuta:fix/subtitles-filter-escape
Draft

Andretuta wants to merge 2 commits into
ColinGPT9:mainfrom
Andretuta:fix/subtitles-filter-escape

Conversation

@Andretuta

@Andretuta Andretuta commented Nov 14, 2026 •

Copy link
Copy Markdown

Problem

A translated burn failed for a clip whose title contained a comma. FFmpeg exited with a filter parse error, and the clip was left without its burned-in captions. The translated output is named after the clip's title, so the comma reached the filtergraph.

Cause

Each renderer passes the captions file's bare name to the subtitles= filter, with cwd set to the captions' folder to avoid Windows drive-letter escaping. The name itself went into the filtergraph unescaped. FFmpeg then reads a , as the start of the next filter, and ', [, ] and ; cause the same failure. A name such as a=b.ass fails too: FFmpeg reads a as an option key ("Option not found"). This affects all eight call sites:

  • multilingual/burn.py
  • video/cropper.py (4 sites)
  • video/cutter.py
  • gaming/compose.py
  • video_editor/export.py

Fix

A single helper, video.filters.subtitles_filter(name), applies FFmpeg's documented two-level escaping from "Notes on filtergraph escaping":

  1. The option value: \ ' : =
  2. The filtergraph: \ ' [ ] , ;

All eight call sites now use it. Nothing else changes: callers still pass a bare name and still set cwd.

Tests

tests/test_subtitles_filter.py checks:

  • the exact escaped string for a name with , ' [ ] ; :;
  • the exact escaped string for a name with =;
  • that a plain name is returned unchanged;
  • a real FFmpeg run that burns captions from a file named Corte, do 'Paulinho' [GTA]; parte 1.ass. Two more real runs use a=b.ass and GTA=top, do 'Paulinho' [x]; parte 1.ass. These cases are skipped when FFmpeg is not installed.

ruff check is clean on the touched files. The existing tests for these modules (21 files) pass.

🤖 Generated with Claude Code

Every renderer passes the captions file's bare name to FFmpeg's subtitles
filter (cwd = the captions' folder). The name went into the filtergraph
unescaped, so a file name with a comma, quote, bracket or semicolon broke
the graph: a translated burn, whose output is named after the clip's title,
failed with a filter parse error when the title had a comma.

One helper, video.filters.subtitles_filter(), applies FFmpeg's documented
two-level escaping and is used at all eight call sites.

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

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

@Andretuta is attempting to deploy a commit to the Clips Studio Team on Vercel.

A member of the Team first needs to authorize it.

@ColinGPT9

ColinGPT9 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

thank you where did you download this version of the app, because this bug was found when I was updating the editor but the new editor isn't in the release yet I am still not finished it.

@ColinGPT9

Copy link
Copy Markdown
Owner

also I can't merge till I am finished the editor it's taking longer than I expected

@ColinGPT9

ColinGPT9 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

i thought i clicked an issue and not a pull request when I first opened this btw lol. I am tired

"a=b.ass" reached FFmpeg as option "a" with value "b.ass" ("Option not
found"), the same failure class as the comma: a translated burn is named
after the clip's title, and _safe_name keeps '='. '=' is now escaped at the
option level, so plain names stay byte-identical.

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

This branch has not been deployed

No deployments
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