Skip to content

Video import PR2b: ffmpeg frame sampling + ffmpeg in Docker image#88

Merged
windoze95 merged 1 commit into
mainfrom
feat/video-frame-sampling
Jun 30, 2026
Merged

Video import PR2b: ffmpeg frame sampling + ffmpeg in Docker image#88
windoze95 merged 1 commit into
mainfrom
feat/video-frame-sampling

Conversation

@windoze95

Copy link
Copy Markdown
Owner

What

PR 2b of the premium video-link import pipeline. Adds frame extraction and the one infra change (ffmpeg in the runtime image).

  • FrameSampler (internal/video/frames.go) — downloads the video's media URL and samples up to MaxFrames (default 30) JPEG frames via ffmpeg. Scene-change detection (select='gt(scene,0.2)') catches quick on-screen text and flashy cuts; falls back to even time-sampling across the full duration when a clip has too few cuts. Frames scaled to 640px (keeps Claude image input at standard resolution → avoids the ~3× high-res token cost). The downloaded source video is always deleted before returning — no source media retained. Exec + download seams → fully unit-tested offline.
  • Dockerfile — runtime base distroless → debian:12-slim + ffmpeg + ca-certificates. Validated with a local docker build (ffmpeg 5.1 present, image assembles & runs).

Cost control

The frame cap is the master cost dial (~$0.0048/frame on Sonnet, $0.0016 on Haiku). 30 frames ≈ $0.14 Sonnet for the AI step; standard-res scaling keeps it there.

Tests

computeFPS clamping, scene-vs-even selection, frame cap, download-error and no-frames paths (all via seams). go test ./... -count=1 → green (12 packages). Local docker build confirms the image builds with ffmpeg.

Next

PR2c: async job + POST /v1/recipes/import/video + poll endpoint, fanning VideoMeta (frames + transcript + caption) into ExtractRecipesFromMedia, with the premium gate, VideoExtractionCache, cost metering, and the daily-budget kill switch — plus the ECS key + a real end-to-end TikTok test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19

PR2b of the video-link import pipeline.
- internal/video: FrameSampler downloads a video's media URL and samples
  up to MaxFrames (default 30) JPEG frames via ffmpeg -- scene-change
  detection (to catch quick on-screen text / flashy cuts) with even
  time-sampling fallback. Frames scaled to 640px (standard-res tokens);
  the source video is always deleted (never retained). Exec + download
  test seams keep it fully unit-tested offline.
- Dockerfile: runtime base distroless -> debian:12-slim + ffmpeg +
  ca-certificates (validated with a local docker build; ffmpeg 5.1 present).

The frame cap is the master cost dial (~$0.0048/frame on Sonnet).
Next: PR2c orchestration (job + endpoints + gate/cache/metering/kill-switch).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@windoze95 windoze95 merged commit 6fae57a into main Jun 30, 2026
1 check passed
@windoze95 windoze95 deleted the feat/video-frame-sampling branch June 30, 2026 03:05
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