> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# TrimVideoLatent ノード

> 潜在空間における動画フレームのトリミング

<img src="https://mintcdn.com/dripart/Rig0_LOInmwVbVSB/images/built-in-nodes/latent/video/trim-video-latent.jpg?fit=max&auto=format&n=Rig0_LOInmwVbVSB&q=85&s=87bf02eabffeba90db7e9409ddf48dd1" alt="ComfyUI TrimVideoLatent ノード" width="1608" height="762" data-path="images/built-in-nodes/latent/video/trim-video-latent.jpg" />

TrimVideoLatent ノードは、潜在空間（LATENT）内で動画フレームをトリミングするために使用されます。動画の潜在変数シーケンスを処理する際に、先頭から不要なフレームを除去する「前方トリミング」を実現するために、よく用いられます。

基本的な使い方：トリミング対象の動画潜在データを `samples` に入力し、`trim_amount` にトリミングするフレーム数を指定します。このノードは、動画の先頭から指定されたフレーム数を削除し、残った潜在変数シーケンスを出力します。\
典型的な利用シーン：動画生成や動画編集などの用途において、不要な先頭フレームを除去する場合、あるいは他のノードと連携して動画セグメントの結合・処理を行う場合などに使用されます。

## パラメータ

### 入力パラメータ

| パラメータ        | 型      | 必須 | デフォルト | 説明                 |
| ------------ | ------ | -- | ----- | ------------------ |
| samples      | LATENT | はい | なし    | 入力する潜在動画データ        |
| trim\_amount | INT    | はい | 0     | トリミングするフレーム数（先頭から） |

### 出力パラメータ

| パラメータ   | 型      | 説明             |
| ------- | ------ | -------------- |
| samples | LATENT | トリミング後の動画潜在データ |

## 使用例

<Card title="Wan2.1 VACE 動画生成ワークフローの例" icon="book" href="/ja/tutorials/video/wan/vace">
  Wan2.1 VACE 動画生成ワークフローの例
</Card>

### ソースコード

```python theme={null}
class TrimVideoLatent:
    @classmethod
    def INPUT_TYPES(s):
        return {"required": { "samples": ("LATENT",),
                              "trim_amount": ("INT", {"default": 0, "min": 0, "max": 99999}),
                             }}

    RETURN_TYPES = ("LATENT",)
    FUNCTION = "op"

    CATEGORY = "latent/video"

    EXPERIMENTAL = True

    def op(self, samples, trim_amount):
        samples_out = samples.copy()

        s1 = samples["samples"]
        samples_out["samples"] = s1[:, :, trim_amount:]
        return (samples_out,)
```
