AD_media_trim_visual
Cut a video/audio file down with marker-based trim points
- video
- audio
- AV_list
- video_list
- audio_list
- time_list
- AV_index
- video_index
- audio_index
- time_index
Before you feed a video into a workflow, you usually need to cut it down first - grab the 8-second clip you actually want out of a 40-second source file, or pull just the frames around a specific moment. AD_media_trim_visual is Apt_Preset's answer to that: a trim node with a visual-editing flavor, judging by its name and the markers_json field, which suggests you place trim markers on a timeline rather than typing raw seconds into a box and hoping for the best.
How it works
Point it at a source file (or wire in media directly), set a start/end range and any additional markers, and it exports the trimmed segments - as file paths, plus the actual extracted frames as an image list. markers_json looks built for defining multiple cut points at once, rather than being limited to one single start/end trim per run.
The inputs and outputs that matter
media_path(STRING) - path to the source file on disk.start_sec/end_sec(FLOAT) - the primary trim range.markers_json(STRING, default"[]") - additional marker/segment data, in JSON. This is almost certainly meant to be written by whatever visual UI this node exposes rather than hand-typed, but it's exposed as a plain string input if you want to script it directly.output_name(default"trim") - the base filename for exported segments.reencode(BOOLEAN, default false) - off means a fast stream-copy cut (no quality loss, but cuts can only land on keyframes); on means a full re-encode, which is slower but lets you cut at an exact frame regardless of keyframe placement.video/audio(optional, wildcard*type) - wire media in directly instead of usingmedia_path, if you're chaining from another node rather than pointing at a file.
Outputs are all lists: audio_list (STRING), video_list (STRING) - file paths for however many segments got cut - and image_list (IMAGE) - the extracted frames.
How to install it
Via ComfyUI Manager: search "ComfyUI-Apt_Preset". Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Then install.bat (Windows, double-click) or pip install -r requirements.txt (Linux/Mac), and restart ComfyUI. Video/audio trimming under the hood typically needs ffmpeg available on your system path - if your environment doesn't already have ComfyUI's usual video-handling dependencies set up, that's the first thing to check if this node fails outright rather than just producing a bad cut.
Common issues & troubleshooting
Cut lands on the wrong frame with reencode off. Stream-copy trimming can only cut cleanly at keyframes, so your exact start_sec/end_sec might snap to the nearest keyframe instead of the precise second you asked for. Turn reencode on if you need frame-accurate cuts and can afford the extra processing time.
markers_json doesn't seem to do anything by itself. It's JSON-structured marker data - if you're hand-editing it, make sure the structure actually matches what the node expects rather than guessing at a format; this is the kind of field that's much easier to use through whatever visual timeline UI the node provides than to construct by hand.
Outputs come back empty. Double-check media_path actually points at a file the ComfyUI process can read, or that you're using the video/audio wildcard inputs correctly if you're not going through a file path at all - a bad path is the most common reason for an empty list output.
Node errors instead of trimming. Missing ffmpeg (or an ffmpeg not on your system path) is a common root cause for video-processing custom nodes in general - worth checking that before assuming the node itself is broken.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| force_rate | FLOAT | 240–120 | 强制输出视频帧率;0表示保持源视频帧率。建议与后续生成节点的fps一致。 |
| split_mode | COMBO | Open Trim UI | 3 options: 按时间分割, 按数量分割, Open Trim UI |
| time | FLOAT | 5.00 | — |
| number | INT | 2 | — |
| index | INT | 1 | 编号从1开始输出,1就是第一个 |
| markers_json | STRING | [] | 前端打标记后自动写入。格式: [1.2, 3.4] |
| output_name | STRING | trim | — |
| videoopt | * | — | |
| audioopt | * | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| AV_list | VIDEO | — |
| video_list | VIDEO | — |
| audio_list | AUDIO | — |
| time_list | FLOAT | — |
| AV_index | VIDEO | — |
| video_index | VIDEO | — |
| audio_index | AUDIO | — |
| time_index | FLOAT | — |