Skip to content

Add funkbox loop fits: check a finished video file against a --target and its seam - #84

Merged
IsraelWebDev merged 1 commit into
mainfrom
feedback/2026-11-29-loop-fits
Nov 29, 2026
Merged

IsraelWebDev merged 1 commit into
mainfrom
feedback/2026-11-29-loop-fits

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

Why

Musicians check a Spotify Canvas file against the rules before they upload. velveteen's Canvas guide (updated 2026-11-28) has a whole "Upload Fixes" section on rejected files. audora's browser Canvas checker (updated 2026-11-08) tests length, 9:16, height and MP4. Neither checks what a loop depends on: whether the last frame flows into the first. loop render --target canvas (#75) only checks loops funkbox renders itself. Rules: Spotify's Canvas guidelines.

What changed

  • New funkbox/loops/fits.py and funkbox loop fits FILE --target canvas|square [--json]. It checks any video file, made with funkbox or not, and prints one ok/FAIL/warn line per rule:

    • shape (9:16 or 1:1);
    • short side (Canvas: 720-1080 px);
    • length (Canvas: 3-8 s, with 0.02 s slack for container rounding);
    • MP4 container and H.264 codec;
    • audio track: a warn for Canvas, not a FAIL, because Spotify's page does not state it as a rule;
    • the seam: it decodes the file at a 96 px short side and compares the last→first step with the typical step, using funkbox/gl/loopcheck.py's thresholds.

    It also prints the file size as info. The exit code is 1 when any rule FAILs, and 2 when the file is missing.

  • The rules come from the existing TARGETS in funkbox/loops/targets.py, so render --target and fits cannot drift apart.

  • Docs: a loop fits line in the quick-start block of docs/loops.md and a paragraph after the target sections.

  • No MCP tool was added or changed (the tool count and docs/catalog.json are unchanged). An MCP option can follow if wanted.

How it was tested

  • tests/test_loop_fits.py (11 tests) encodes small synthetic waves with ffmpeg. It covers:
    • a seamless Canvas file fits;
    • a file that jumps at the wrap fails only the seam;
    • a wrong shape, size and length are each named;
    • an audio track gives a warn but the file still fits;
    • mpeg4 in an .mkv fails format and codec;
    • square has no size or length rules;
    • an unknown target is refused;
    • the CLI's exit codes and --json output.
  • Manual run on real files: today's loop render --preset lava-lamp --target canvas output fits (seam 9.59 vs typical 8.78; 24.0 MB). A 3.1 s cut of it fails the seam (53.07 vs 8.88). A 9:16 loop checked as --target square fails the shape rule.
  • Full suite: FUNK_GL_BACKEND=egl python -m pytest -q gives 1568 passed and 21 skipped. ruff format and ruff check are clean.

Nothing under promo/ changed.

From the 2026-11-29 promo run's product feedback.


Generated by Claude Code

…ts seam

From the 2026-11-29 promo run's product feedback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RsXeVj1YR1UgjH3YehPng
@IsraelWebDev
IsraelWebDev merged commit cd59e6b into main Nov 29, 2026
4 checks passed
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