> ## 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.

# PixVerse Transition Video - ComfyUI ネイティブノードドキュメント

> PixVerse の AI を使用して、開始フレームと終了フレーム間のスムーズなトランジション動画を作成します

<img src="https://mintcdn.com/dripart/5003JSxULDwNImme/images/built-in-nodes/api_nodes/pixverse/pixverse-transition-video.jpg?fit=max&auto=format&n=5003JSxULDwNImme&q=85&s=13d19c52ceb204b914331211525aca82" alt="ComfyUI ネイティブ PixVerse Transition Video ノード" width="1731" height="1659" data-path="images/built-in-nodes/api_nodes/pixverse/pixverse-transition-video.jpg" />

PixVerse Transition Video ノードは、PixVerse のトランジション動画生成 API に接続し、指定した開始画像と終了画像の間に滑らかな動画トランジションを生成します。このノードはすべての中間フレームを自動的に生成し、モーフィング効果、シーン切り替え、オブジェクトの変化などに最適な流暢な変形を実現します。

## パラメーター

### 必須パラメーター

| パラメーター            | 型   | デフォルト                       | 説明                            |
| ----------------- | --- | --------------------------- | ----------------------------- |
| first\_frame      | 画像  | -                           | 動画の開始フレーム画像                   |
| last\_frame       | 画像  | -                           | 動画の終了フレーム画像                   |
| prompt            | 文字列 | ""                          | 動画およびトランジションの内容を記述するテキストプロンプト |
| quality           | 選択肢 | "PixverseQuality.res\_540p" | 出力動画の品質                       |
| duration\_seconds | 選択肢 | -                           | 生成される動画の再生時間（秒）               |
| motion\_mode      | 選択肢 | -                           | 動画のモーションスタイル                  |
| seed              | 整数  | 0                           | 乱数シード（範囲：0–2147483647）        |

### オプションパラメーター

| パラメーター             | 型                  | デフォルト | 説明                        |
| ------------------ | ------------------ | ----- | ------------------------- |
| negative\_prompt   | 文字列                | ""    | 動画に含めたくない要素を指定            |
| pixverse\_template | PIXVERSE\_TEMPLATE | None  | 生成スタイルに影響を与えるオプションのテンプレート |

### パラメーター制約

* `quality` を `1080p` に設定した場合、`motion_mode` は強制的に `normal` に、`duration_seconds` は強制的に `5` 秒に設定されます。
* `duration_seconds` が `5` 秒でない場合、`motion_mode` は強制的に `normal` に設定されます。

### 出力

| 出力    | 型  | 説明      |
| ----- | -- | ------- |
| VIDEO | 動画 | 生成された動画 |

## ソースコード

```python theme={null}

class PixverseTransitionVideoNode(ComfyNodeABC):
    """
    Generates videos synchronously based on prompt and output_size.
    """

    RETURN_TYPES = (IO.VIDEO,)
    DESCRIPTION = cleandoc(__doc__ or "")  # Handle potential None value
    FUNCTION = "api_call"
    API_NODE = True
    CATEGORY = "api node/video/Pixverse"

    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "first_frame": (
                    IO.IMAGE,
                ),
                "last_frame": (
                    IO.IMAGE,
                ),
                "prompt": (
                    IO.STRING,
                    {
                        "multiline": True,
                        "default": "",
                        "tooltip": "Prompt for the video generation",
                    },
                ),
                "quality": (
                    [resolution.value for resolution in PixverseQuality],
                    {
                        "default": PixverseQuality.res_540p,
                    },
                ),
                "duration_seconds": ([dur.value for dur in PixverseDuration],),
                "motion_mode": ([mode.value for mode in PixverseMotionMode],),
                "seed": (
                    IO.INT,
                    {
                        "default": 0,
                        "min": 0,
                        "max": 2147483647,
                        "control_after_generate": True,
                        "tooltip": "Seed for video generation.",
                    },
                ),
            },
            "optional": {
                "negative_prompt": (
                    IO.STRING,
                    {
                        "default": "",
                        "forceInput": True,
                        "tooltip": "An optional text description of undesired elements on an image.",
                    },
                ),
                "pixverse_template": (
                    PixverseIO.TEMPLATE,
                    {
                        "tooltip": "An optional template to influence style of generation, created by the Pixverse Template node."
                    }
                )
            },
            "hidden": {
                "auth_token": "AUTH_TOKEN_COMFY_ORG",
            },
        }

    def api_call(
        self,
        first_frame: torch.Tensor,
        last_frame: torch.Tensor,
        prompt: str,
        quality: str,
        duration_seconds: int,
        motion_mode: str,
        seed,
        negative_prompt: str=None,
        pixverse_template: int=None,
        auth_token=None,
        **kwargs,
    ):
        first_frame_id = upload_image_to_pixverse(first_frame, auth_token=auth_token)
        last_frame_id = upload_image_to_pixverse(last_frame, auth_token=auth_token)

        # 1080p is limited to 5 seconds duration
        # only normal motion_mode supported for 1080p or for non-5 second duration
        if quality == PixverseQuality.res_1080p:
            motion_mode = PixverseMotionMode.normal
            duration_seconds = PixverseDuration.dur_5
        elif duration_seconds != PixverseDuration.dur_5:
            motion_mode = PixverseMotionMode.normal

        operation = SynchronousOperation(
            endpoint=ApiEndpoint(
                path="/proxy/pixverse/video/transition/generate",
                method=HttpMethod.POST,
                request_model=PixverseTransitionVideoRequest,
                response_model=PixverseVideoResponse,
            ),
            request=PixverseTransitionVideoRequest(
                first_frame_img=first_frame_id,
                last_frame_img=last_frame_id,
                prompt=prompt,
                quality=quality,
                duration=duration_seconds,
                motion_mode=motion_mode,
                negative_prompt=negative_prompt if negative_prompt else None,
                template_id=pixverse_template,
                seed=seed,
            ),
            auth_token=auth_token,
        )
        response_api = operation.execute()

        if response_api.Resp is None:
            raise Exception(f"Pixverse request failed: '{response_api.ErrMsg}'")

        operation = PollingOperation(
            poll_endpoint=ApiEndpoint(
                path=f"/proxy/pixverse/video/result/{response_api.Resp.video_id}",
                method=HttpMethod.GET,
                request_model=EmptyRequest,
                response_model=PixverseGenerationStatusResponse,
            ),
            completed_statuses=[PixverseStatus.successful],
            failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted],
            status_extractor=lambda x: x.Resp.status,
            auth_token=auth_token,
        )
        response_poll = operation.execute()

        vid_response = requests.get(response_poll.Resp.url)
        return (VideoFromFile(BytesIO(vid_response.content)),)
```
