Skip to content

Studio: accept chat videos up to 256 MB - #17400

Merged
danielhanchen merged 7 commits into
mainfrom
studio-video-upload-256mb
Nov 11, 2026
Merged

danielhanchen merged 7 commits into
mainfrom
studio-video-upload-256mb

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Fixes #17062

Why

Chat refused any video over 64 MB, which is roughly 50 seconds of 720p. That number was picked when video input landed (#9057) so the composer, the route and the desktop reader agreed with each other. Nothing in the model path needs it:

  • llama-server picks frames by duration (fps sampling with per-model frame clamps), not by file size, so a bigger file does not mean more context.
  • Studio already re-encodes any clip larger than 640x360 to 640x360 at 4 fps before llama-server sees it. A 3 minute 720p clip at 8 Mbps (180 MiB) comes out at about 19 MiB.

The real ceiling is llama-server's HTTP layer, which refuses request bodies over 100 MB (CPPHTTPLIB_PAYLOAD_MAX_LENGTH in its vendored cpp-httplib). The clip travels as base64 in JSON, so anything above about 74 MB that reaches llama-server untouched would fail there.

What changes

  • The composer and the chat route accept clips up to 256 MB. Its base64 (about 341M characters) stays under the browser's maximum string length, and the request stays under Studio's default 500 MB body cap.
  • The pre-llama transcode also runs when a clip is larger than 64 MB, even if its frames are already small, so llama-server never gets a body near its 100 MB limit. Clips at or under 64 MB take exactly the same path as before.
  • After transcoding, the video payload going to llama-server (all clips in the request together) is checked against that 64 MB budget. A clip that could not be brought under it (failed or timed out transcode, or a very long clip) gets a clear 413 asking for a shorter clip instead of an opaque llama-server error. Anything that was valid on main (64 MB total) still fits.
  • A size-only re-encode (frames already small, frame rate already low) runs without a video filter, since ffmpeg refuses an empty -vf. Every refusal on this path also finalizes the API monitor entry.
  • The 413 messages and the tests that pinned 64 MB are updated, and tests cover a small-frame clip over the forward budget being transcoded, a clip still over budget after transcoding, and several clips over budget together.

Nothing else in the UI or the flow moves: same attach button, same toasts, same one clip per message. Desktop drag-and-drop keeps its native reader cap (about 72 MB, shared with the video generation reference picker); the attach button in Desktop uses the webview picker and gets the new limit.

Evidence

Route functions (_video_b64_rejection, then _shrink_clip_for_llama) on synthetic clips, main vs this branch:

Clip main this branch
180 MiB, 180 s, 1280x720 413 Video file is too large (max 64 MB). accepted, forwarded 18.9 MiB (about 25 MiB of JSON) in 20 s
99 MiB, 20 s, 640x360 at 40 Mbps 413 accepted, transcoded to 13.9 MiB (without the new trigger it would have gone to llama-server as about 132 MB of JSON)
297 MiB, 60 s, 640x360 413 413 Video file is too large (max 256 MB).

The synthetic clips are noise-heavy, so real footage shrinks further.

Testing

  • node --test on the video, native drop and reference size suites: 232 passing; tsc --noEmit clean
  • Backend: test_video_pr9057_simulation.py 68, test_video_attachment_part.py 32, test_video_chat_completions_behaviour.py 80, test_llama_video_frame_budget.py 41, test_llama_video_ffmpeg.py 20 (2 skipped, same as main), media decode suites 54, all passing
  • The new transcode test fails on main (the 99 MiB-style small-frame clip is forwarded untouched) and passes here

Before / after

A 99 MiB clip attached in the chat composer (no model loaded, so only the size check runs). Before: refused with a 64MB toast. After: it sits in the composer as an attachment.

Composer before and after

@danielhanchen danielhanchen self-assigned this Nov 10, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:23:17.279135Z 0792f2e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 10, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: bb5f85b664

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 11, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 11, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 11, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 11, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 0792f2e6c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Upload video limited at 64MB, make it bigger please

1 participant