Video import PR2b: ffmpeg frame sampling + ffmpeg in Docker image#88
Merged
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 toMaxFrames(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.debian:12-slim+ffmpeg+ca-certificates. Validated with a localdocker 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
computeFPSclamping, scene-vs-even selection, frame cap, download-error and no-frames paths (all via seams).go test ./... -count=1→ green (12 packages). Localdocker buildconfirms the image builds with ffmpeg.Next
PR2c: async job +
POST /v1/recipes/import/video+ poll endpoint, fanningVideoMeta(frames + transcript + caption) intoExtractRecipesFromMedia, 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