Skip to content

Size generated pictures for the video they go into - #29

Merged
davior merged 1 commit into
mainfrom
claude/gracious-sagan-jwbzsr
Oct 29, 2026
Merged

davior merged 1 commit into
mainfrom
claude/gracious-sagan-jwbzsr

Conversation

@davior

@davior davior commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Why

GVC asked GAM for a picture by aspect alone:

  • FLUX made 1024×576 for a 1080p video.
  • Nano Banana used its 1K default.
  • Seedream got no size at all.

The result was about half the frame's width, and softer still once a Ken Burns zoom or an S1 crop reads into part of it.

What

  • Target. target_size(aspect, resolution) is the output frame (render/options.frame_size) × PICTURE_HEADROOM = 1.5, in the placeholder's own aspect. A 1080p 16:9 video targets 2880×1620; a 1:1 picture in it targets 1620×1620.
  • Choosing the size in default_params(…, target=):
    1. A model with custom_size (GAM-8, davior/gam#53) gets width/height. If the target is over the model's limits, it is shrunk with the aspect kept and rounded to the model's multiple. FLUX at 1080p asks for 2880×1616.

    2. A model with size tiers (Nano Banana's 0.5K…4K, Seedream's auto_2K/4K) gets the tier nearest the target by ratio, but never one smaller than the frame while a larger one exists:

      • 1080p gets 2K (1.43× the frame).
      • 4K gets 4K.
      • 720p gets 1K, which is still above the frame.

      "Smallest at or above 1.5×" would have sent every 1080p picture to 4K.

    3. Otherwise behave as before. Against a GAM without GAM-8, FLUX keeps its preset.

  • Clips are unchanged, including the picture made for a clip from a prompt. That's out of scope for now.
  • Estimate. Megapixel pricing uses the custom size and counts fal's whole 1024² megapixels, which is how GAM is billed.
    • FLUX schnell at 2880×1616 is 5 MP, $0.015.
    • FLUX dev at that size is about $0.125 per picture.
  • Docs. GAM-8 is added to the plan's "Changes needed in GAM".

Tests

  • pytest -q: 755 passed. Covers target sizes, custom-size clamping, tier choice and the never-below-the-frame rule, Seedream's auto sizes, the old-GAM fallback, the estimate, and HTTP paths through the fake GAM.
  • npm test: 192 passed. npm run build: clean. No frontend change.

Generated by Claude Code

A picture was asked for by aspect alone, so FLUX made 1024x576 for a
1080p video and Nano Banana its 1K default: half the frame's width,
softer still once a Ken Burns zoom or a crop reads into it.

A picture placeholder now targets 1.5x the output frame, in its own
aspect. A model that takes any size (GAM-8's custom_size, on FLUX) is
asked for exactly that, within its limits. A model with size tiers gets
the tier nearest the target that is not smaller than the frame. Against
a GAM without GAM-8, FLUX keeps its preset as before. Clips are
unchanged.

The megapixel estimate now counts fal's whole 1024² megapixels, which
is how GAM is billed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD2v7vJwCcyYXHHkrxP
@davior
davior marked this pull request as ready for review October 29, 2026 00:34
@davior
davior merged commit 7d0337b into main Oct 29, 2026
3 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