Skip to content

feat: AI-based overlay image position for editorial templates#138

Open
recoup-coding-agent wants to merge 1 commit intomainfrom
feature/rec-67-overlay-position
Open

feat: AI-based overlay image position for editorial templates#138
recoup-coding-agent wants to merge 1 commit intomainfrom
feature/rec-67-overlay-position

Conversation

@recoup-coding-agent
Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent commented Apr 14, 2026

Summary

  • Adds AI-powered overlay position analysis using ToolLoopAgent to determine the best corner for playlist cover/DSP logo overlays on editorial images
  • Replaces hardcoded top-left positioning with dynamic position (top-left, top-right, bottom-left, bottom-right) based on image analysis
  • Falls back to top-left if AI analysis fails

Changes

  • New: overlayPosition.ts — shared type + coordinate calculation utility
  • New: createOverlayPositionAgent.ts — ToolLoopAgent that analyzes editorial images
  • New: resolveOverlayPosition.ts — wrapper that calls the agent with fallback
  • Updated: buildStaticImageArgs.ts, buildFilterComplex.ts, buildFfmpegArgs.ts, renderFinalVideo.ts — accept and use overlayPosition parameter
  • Updated: createContentTask.ts — resolves overlay position before rendering

Test plan

  • 10 unit tests for calculateOverlayCoordinates (all 4 positions + custom sizes)
  • 4 new tests for buildFilterComplex position variants
  • All 359 existing tests pass
  • Manual verification with editorial template content creation

🤖 Generated with Claude Code


Summary by cubic

Chooses the best corner for playlist/DSP overlays on editorial images instead of always using top-left, improving subject visibility. Defaults to top-left on failure. Implements REC-67.

  • New Features
    • Added createOverlayPositionAgent to analyze an editorial image and return top-left, top-right, bottom-left, or bottom-right.
    • Added overlayPosition.ts with types and calculateOverlayCoordinates; used by overlay pipelines.
    • Integrated position through the pipeline: resolveOverlayPosition in createContentTask, plus support in buildFilterComplex, buildFfmpegArgs, renderFinalVideo, and new buildStaticImageArgs.
    • Tests added for coordinate math and filter placement; existing tests pass.

Written for commit bb50a64. Summary will update on new commits.

Use ToolLoopAgent to analyze editorial images and determine the ideal
corner (top-left, top-right, bottom-left, bottom-right) for overlay
placement instead of always defaulting to top-left.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

Warning

Rate limit exceeded

@recoup-coding-agent has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 39 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 7 minutes and 39 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bca51073-7481-4efa-bc57-6a10eb99a02f

📥 Commits

Reviewing files that changed from the base of the PR and between ddf9404 and bb50a64.

📒 Files selected for processing (10)
  • src/agents/createOverlayPositionAgent.ts
  • src/content/__tests__/buildFilterComplex.test.ts
  • src/content/__tests__/overlayPosition.test.ts
  • src/content/buildFfmpegArgs.ts
  • src/content/buildFilterComplex.ts
  • src/content/buildStaticImageArgs.ts
  • src/content/overlayPosition.ts
  • src/content/renderFinalVideo.ts
  • src/content/resolveOverlayPosition.ts
  • src/tasks/createContentTask.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/rec-67-overlay-position

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

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