Skip to content

Escape quotes in concat listings, so titles like "I'll" join - #216

Merged
ColinGPT9 merged 1 commit into
mainfrom
fix/issue-197
Nov 5, 2026
Merged

ColinGPT9 merged 1 commit into
mainfrom
fix/issue-197

Conversation

@ColinGPT9

Copy link
Copy Markdown
Owner

Fixes the cause of #197. Longform failed every time on a video titled "First Time. Surely I'll be fine. Let's skip the tutorial", with FFmpeg unable to open …/First Time. Surely Ill.

Cause

  • Folder names: clip folders are named after the video's title, apostrophes included.
  • The listing: every join without re-encoding (video/encoding.py concat()) hands FFmpeg a listing of file '<path>' lines.
  • No escaping: nothing escaped a quote inside a path, so FFmpeg read each path only up to the apostrophe and found nothing.

Four places wrote those lines:

Writer With an apostrophe in the title
longform/assemble.py The job fails. This is #197.
video/outro.py, append() and finish() The end card's join fails quietly. The clip is remuxed without its card, so every clip of such a video had no end card. That's why the reporter's other clips "worked fine".
sports/core/reels.py The story reel fails.

Fix

  • One helper: video/encoding.py concat_entry() writes each line. It closes, escapes and reopens a quote ('\''), as FFmpeg's quoting spells it. A path without a quote is written exactly as before.
  • All four writers use it.
  • A guard: a test fails if any other Python file writes a file '{…}' line itself.

Checked

End to end, in a folder named like the reporter's. It used a real 1080p60 source and the real end card:

End card Longform
main skipped: clip 5.00 s, no card concat join failed … No such file or directory (#197)
this PR added: 7.90 s (5 s + 2.9 s card) made: 10.90 s

Tests, in tests/test_video_join.py; CI runs them, and the real joins skip without FFmpeg:

  • the escaping, and an unchanged line for a path without a quote;
  • a real join in the reporter's folder name, where the old listing fails and the new one joins 6 s;
  • the guard.

Local runs:

  • ruff is clean.
  • test_outro, test_outro_join, test_video_join, test_sports_reels and test_selection_longform all pass in the full environment.
  • In the CI-light venv, everything passes except three SDK new tests, which fail the same way on unchanged main inside a Windows venv.

Refs #197

🤖 Generated with Claude Code

Issue #197: Longform failed every time on a video titled "First Time.
Surely I'll be fine. Let's skip the tutorial", with FFmpeg unable to open
".../First Time. Surely Ill".

Clip folders are named after the video's title, and every join without
re-encoding hands FFmpeg a listing of `file '<path>'` lines. Nothing
escaped a quote inside a path, so FFmpeg read each path only up to the
apostrophe. Four places wrote those lines:

- longform/assemble.py: the job failed (the report).
- video/outro.py, append() and finish(): the end card's join failed
  quietly, so every clip of such a video was made without its card.
- sports/core/reels.py: the story reel failed.

video/encoding.py concat_entry() now writes each line, closing, escaping
and reopening a quote ('\'') as FFmpeg's quoting spells it. A path
without a quote is written exactly as before. All four use it, and a test
fails if anything else writes a line itself.

Checked end to end in a folder named like the reporter's. On main, the end
card is skipped (5.00s clip) and Longform fails with #197's error. With
this change, the card is added (7.90s) and Longform is made (10.90s).

Refs #197

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

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clips-kitty-web Ready Ready Preview Nov 5, 2026 4:36am UTC
1 Skipped Deployment
Project Deployment Actions Updated
clips-studio Ignored Ignored Preview Nov 5, 2026 4:36am UTC

@ColinGPT9
ColinGPT9 merged commit e5fde41 into main Nov 5, 2026
12 checks passed
@ColinGPT9
ColinGPT9 deleted the fix/issue-197 branch November 5, 2026 04:41

This branch was successfully deployed

1 active deployment
Preview – clips-kitty-web — e0867c78 Deployed Nov 5, 2026 by vercel[bot]
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.

1 participant