TS SAM Media Loader
Stop hand-typing SAM3 point JSON — just click the picture
- model
- images
- positive_coords
- negative_coords
- fps
- audio
- initial_mask
SAM3 (Meta's promptable segmentation line) is one of the best things to happen to masking in ComfyUI - you give it a point or two and it returns a clean mask for that object, zero-shot, on anything. The catch is that the native SAM3 Detect node wants its prompts as JSON strings, and typing coordinates by hand for a video frame is miserable. This node is the clicky front end: load an image or video, click green (positive) and red (negative) points right on a first-frame preview, and get back the exact prompt JSON the native SAM3 nodes expect.
How it works
It's a loader with a point-picker bolted on. Drop an image or a video file in, and the node's body shows the first frame. Every click records a point in pixel space; positive (green) points say "this is the thing," negative (red) points say "this is NOT the thing." That's the same interaction you'd have in the original SAM demo - a few clicks to steer the mask, and SAM3 does the rest.
The outputs are what make it play nicely with the native stack:
images- the loaded frames as an IMAGE batch (frame_stridedecodes every N-th frame for video;max_framescaps the count).positive_coordsandnegative_coords- STRING JSON in the SAM3 point-prompt format. Wire those straight into SAM3 Detect's point-prompt inputs.fpsandaudio- the video's frame rate and audio track, pulled out for free.initial_mask- if you also connect a SAM3model, the node renders the first-frame mask itself, ready to feed SAM3 Video Track for tracking.
One honest caveat: the optional model input is preview-only. It lets the node draw a blue mask overlay so you can see what your points did, but the actual SAM3 Detect in your workflow should be wired to the model loader directly. Don't connect this node's model and expect it to do the segmentation for you.
The settings that matter
The top four inputs (source_path, media_type, coordinates, neg_coordinates, sam3_checkpoint) are annotated as internal - the node writes them as you click; you don't. The two you might touch are frame_stride (1 = every frame, which is what you want for tracking; higher for a quick look) and max_frames (a memory guard for long clips).
Install
No extra dependencies. It's part of comfyui-timesaver, and SAM3 itself ships with native ComfyUI - so this is the rare node that installs and just works. Video frames come through the pack's bundled imageio-ffmpeg, so you don't even need a system ffmpeg.
cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt
Then restart ComfyUI, add the node, and drop a file in.
Common issues
- "My points do nothing." Check that you're feeding
positive_coords/negative_coordsinto the point-prompt sockets of a real SAM3 Detect node - and that Detect is wired to its own model loader. This loader only formats the prompts. - Strange frame count for video.
frame_stride> 1 means you're sampling frames, not skipping them - a 60 fps clip at stride 2 gives you 30 frames at real-time speed. That's usually what you want, just don't be surprised. - No audio output for a clip. The
audiooutput is empty for images by design; for video, checkmax_framesandframe_stridearen't set so aggressively that the decoded selection has nothing to carry the audio. Frames and audio come from the same decode.
Where this shines is the SAM3 Video Track workflow: points → initial_mask on frame one → tracking across the clip. Without this node, that's a wall of JSON you'd be typing by hand.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| source_path | STRING | Internal: annotated path of the loaded image or video. | |
| media_type | STRING | Internal: 'image' or 'video'. | |
| coordinates | STRING | [] | Internal: positive point JSON (pixel space of first frame). |
| neg_coordinates | STRING | [] | Internal: negative point JSON (pixel space of first frame). |
| sam3_checkpoint | STRING | Internal: auto-detected checkpoint filename of the connected SAM3 model loader. Used by the preview overlay route only. | |
| max_frames | INT | 00–10000 | Hard cap on decoded video frames (0 = no cap). |
| frame_stride | INT | 11–60 | Decode every N-th video frame (1 = every frame). |
| modelopt | MODEL | Optional SAM3 model. Connect a SAM3 checkpoint loader to enable the in-node blue mask preview overlay. The link is preview-only: the workflow's SAM3 Detect should be wired to the loader directly. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Loaded frames as an image batch (N frames for video). |
| positive_coords | STRING | Positive point prompts as a SAM3 JSON string. |
| negative_coords | STRING | Negative point prompts as a SAM3 JSON string. |
| fps | FLOAT | Frame rate of the loaded video (0 for images). |
| audio | AUDIO | Audio track extracted from the video (empty for images). |
| initial_mask | MASK | First-frame SAM3 mask, when a model and points are provided. |