Repository navigation
feat(video): add the DubVideo tool that dubs a clip through the Videos API - #1844
Conversation
…workflow Registered only when video_to_sfx.enabled and video_to_sfx.dub are both true, the switch pattern CreateAvatar uses under text_to_video. The tool posts the multipart create to /v1/videos with video_to_sfx.model (default mirelo/sfx-2.0), polls the job with the TextToVideo polling code and its timeout and poll_interval knobs, and downloads the MP4 from /content. The description states Mirelo's limit that only the generated mix is laid onto the clip, so it offers no track parameter. The dub create rides a small CLI-side gateway (agentinfra.DubGateway) because the SDK's CreateVideo drops the dubbing fields (the video part and preserve_speech) that schemas v1.14.0 added - the sync PR did not extend the SDK's hand-written encoder. The SDK client keeps covering retrieve and content download, and the auto-started gateway also gets VIDEOS_ENABLED=true while the dub switch is on. Tests cover create, poll and download against a stubbed Videos API: infrastructure unit tests plus a full-loop integration test, along with config, tool and registry gating tests.
tools-reference.md gains a DubVideo row and section, text-to-video.md a Dubbing section with the configuration and Mirelo's mix-only limit, and configuration-reference.md documents the video_to_sfx block with its env overrides and the VIDEOS_ENABLED wiring the gateway now gets while the dub switch is on.
main gained the VideoToSFX tool, which defines the same video_to_sfx config block this branch introduced for DubVideo. - config: one VideoToSFXConfig - main's enabled, model, output_dir and require_approval plus this branch's dub switch - registry: both tools register, VideoToSFX on enabled and DubVideo on enabled and dub - container: the dub gateway reuses main's gatewayEndpoint and the duplicate sdkBaseURL helper is dropped - tools: one shared videoExtensions list, and the DubVideo tests pass the extra NewRegistry argument - golden tool definitions: 52 built-ins - docs: the two video_to_sfx config sections are folded into one
The tool spelled its argument names, result keys, output file prefix and extension as literals, each typed in Validate and again in Execute. They are now constants, the accepted clip formats in its errors come from the shared videoExtensions list, and the tests refer to ToolDubVideo. The result key a media tool reports its saved file under gets one name, savedPathKey, used by the shared formatter, DubVideo and VideoToSFX.
The dubbing create spelled its form field names, the Videos route, the provider query parameter, the success status bounds, the error read cap and the MiB conversion as literals. They are now constants, and the upload limit in its error is derived from maxVideoUploadBytes. The header names and bearer scheme are named once and shared by the two raw gateway requests, the dub create and the VideoToSFX scoring call.
Dub split its model id on a literal slash where config.ParseModel already does it. Its oversize test hardcoded 11 MiB instead of one byte past maxVideoUploadBytes, and the integration test spelled the default model id that config.VideoToSFXGatewayDefaultModel names.
The rule that DubVideo needs both video_to_sfx.enabled and dub was spelled out in the registry, the tool and twice in the gateway supervisor, where it also sat unparenthesized next to the TextToVideo check. VideoToSFXConfig.DubEnabled now owns the rule and Config.NeedsGatewayVideos decides when the managed gateway gets VIDEOS_ENABLED, the way NeedsGatewayAudio already does for the Audio API.
|
@infer can you review this PR? is it ready for merge? use /ponytail:ponytail /ponytail:ponytail-review /clean-architecture /clean-code /domain-driven-design /go /go-concurrency Any code smell? |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll verifications are complete: full test suite green, lint clean. Let me finalize the todos and deliver the review. Review of PR #1844 - DubVideo toolWhat this change does: Adds the DubVideo agent tool, which dubs an existing clip through the gateway's Videos API: a multipart create (the SDK's CreateVideo drops the dub fields, so a small CLI-side Architecture check (clean-architecture / DDD / clean-code / go / go-concurrency): holds up well. Findings: Must fix:
Should fix:
Nice to have:
Verdict: fix 1 and 2 first. Lean: -6 lines possible. Not checked: the gateway's real Videos API dub form contract against the Model: Tokens: 1,641,284 in · 30,262 out · 1,671,546 total (22 requests) Tool calls: 34 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
- The dub create read the whole clip into memory before checking it against the upload limit, so a multi-gigabyte clip could exhaust memory instead of returning the limit error. It now checks the file size first and streams the clip into the form. The error calls the limit the gateway's default, which stays true when an operator raises it. - DubVideo ignored video_to_sfx.require_approval, so the approval a user set for footage leaving the machine covered VideoToSFX but not a dub. - The clip name is trimmed once, so a name with surrounding spaces passes the extension check as it does in VideoToSFX. - Rendering and dubbing share one job deadline helper, and Render splits its model id with config.ParseModel like the other gateway services.
|
🎉 This PR is included in version 0.262.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1840
Summary
Adds the DubVideo agent tool: a Mirelo model dub of an existing clip through the gateway's Videos API. The tool posts the multipart create to POST /v1/videos, polls the job with the TextToVideo polling code and its timeout and poll_interval knobs, and downloads the finished MP4 from /content. It is registered only when both video_to_sfx.enabled and video_to_sfx.dub are true - the switch pattern CreateAvatar uses under text_to_video - and its description states Mirelo's limit that only the generated mix is laid onto the clip, so it offers no track parameter.
The video_to_sfx block itself landed on main with the VideoToSFX tool (#1843) while this PR was open. This PR now adds only the dub switch to it, so video_to_sfx.enabled registers VideoToSFX as on main and DubVideo needs enabled and dub together.
The SDK (v1.46.0) carries the dubbing fields in CreateVideoRequest but its hand-written CreateVideo encoder drops them, so the dub create rides a small CLI-side gateway (agentinfra.DubGateway) that posts the same multipart form with bearer auth and provider routing. The SDK client keeps covering retrieve and content download, and go.mod ends this PR byte-identical to main.
Changes
Downstream impact