Skip to content

fix: respect single-quoted strings when splitting FFmpeg filtergraph (#593)#938

Open
lucemia wants to merge 2 commits into
mainfrom
fix/593-single-quote-filterchain-split
Open

fix: respect single-quoted strings when splitting FFmpeg filtergraph (#593)#938
lucemia wants to merge 2 commits into
mainfrom
fix/593-single-quote-filterchain-split

Conversation

@lucemia
Copy link
Copy Markdown
Owner

@lucemia lucemia commented May 6, 2026

Summary

  • Root cause: splitUnescaped (TypeScript) and _split_unescaped (Python) used a simple regex/lookbehind that only handled backslash-escaped separators. FFmpeg filter option syntax also allows single-quoted strings (e.g. force_style='Fontname=Arial,Fontsize=17') where commas and other separator characters must be treated as literal content, not split points.
  • Fix: Rewrote both functions to iterate character-by-character, tracking whether we're inside a single-quoted section, and skipping any separator that appears within quotes.
  • Scope: Template (compile_cli.py.jinja) + all four generated packages (v5–v8) + TypeScript core. Both implementations are now identical in behaviour.

Test plan

  • New TypeScript test: -vf filterchain with single-quoted force_style value containing commas — verifies scale, pad, subtitles all appear in compiled output
  • New Python test: same scenario — test_vf_single_quoted_params_with_commas
  • All existing TypeScript tests pass: 138/138
  • All existing Python tests pass: 139/139 (6 skipped)

Fixes #593

🤖 Generated with Claude Code

lucemia and others added 2 commits May 6, 2026 12:19
Commas and other separators inside single-quoted filter option values
(e.g. force_style='Fontname=Arial,Fontsize=17') were incorrectly treated
as filterchain separators, breaking parse of commands like the one
reported in issue #593.

Rewrote `splitUnescaped` (TypeScript) and `_split_unescaped` (Python)
to iterate character-by-character, skipping separators that appear
inside single-quoted sections. Backslash escaping outside quotes is
preserved. Both implementations now behave identically; tests added
for both to verify the fix.

Fixes #593

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Playground command parsing error

1 participant