From 8a6ad06c8c9d70b275e8b1286611b09e1c8a61fb Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Mon, 3 Aug 2026 22:33:16 +0200 Subject: [PATCH] fix(subtitles): name the filter option so ffmpeg 8 can parse the burn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ffmpeg 8's filtergraph parser rejects a quoted positional value followed by more :name=value options — ass='x.ass':fontsdir='…' now fails with "No option name near …", so every caption burn breaks on ffmpeg >= 8 (found live-testing the MCP add_subtitles tool on a Homebrew 8.1.1). The named form (ass=filename='…') parses identically on 4.x through 8. --- subtitles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subtitles.py b/subtitles.py index aa99cd2..baab575 100644 --- a/subtitles.py +++ b/subtitles.py @@ -530,12 +530,16 @@ def burn_subtitles(video_path, srt_path, output_path, alignment=2, fontsize=16, fonts_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fonts") safe_fonts_dir = _escape_ffmpeg_filter_value(fonts_dir) + # The first option is named explicitly (filename=) rather than positional: + # ffmpeg 8's filtergraph parser rejects a quoted positional value that is + # followed by more :name=value options ("No option name near ..."), while + # the named form parses on every version back to 4.x. if str(srt_path).lower().endswith('.ass'): # ASS files (karaoke style) carry their own styles; force_style would # override the per-word color tags. - vf = f"ass='{safe_srt_path}':fontsdir='{safe_fonts_dir}'" + vf = f"ass=filename='{safe_srt_path}':fontsdir='{safe_fonts_dir}'" else: - vf = (f"subtitles='{safe_srt_path}':fontsdir='{safe_fonts_dir}'" + vf = (f"subtitles=filename='{safe_srt_path}':fontsdir='{safe_fonts_dir}'" f":charenc=UTF-8:force_style='{style_string}'") cmd = [