# MuapiClient processV2V vs generateVideo: Key Differences in Open-Generative-AI

> Discover the key differences between MuapiClient's processV2V and generateVideo methods in Open-Generative-AI. Understand video transformation vs. text-to-video generation for your AI projects.

- Repository: [Anil Chandra Naidu Matcha/Open-Generative-AI](https://github.com/Anil-matcha/Open-Generative-AI)
- Tags: deep-dive
- Published: 2026-04-24

---

**While both methods belong to the `MuapiClient` class and handle asynchronous video operations, `processV2V` transforms existing videos using video-to-video models that require a `video_url` input, whereas `generateVideo` creates new videos from text prompts using video generation models.**

The Open-Generative-AI repository provides the `MuapiClient` class in [`src/lib/muapi.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/muapi.js) to abstract interactions with Muapi's AI video services. Developers must select between `processV2V` and `generateVideo` based on whether their workflow involves modifying existing footage or synthesizing new content from scratch. These methods target distinct model families, construct different request payloads, and resolve separate endpoints through helper functions defined in [`src/lib/models.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/models.js).

## Video-to-Video vs Video Generation: The Core Distinction

The fundamental difference lies in the model families each method invokes.

### ProcessV2V: Transforming Existing Content

The `processV2V` method utilizes **video-to-video (V2V)** models retrieved via `getV2VModelById` (located in [`src/lib/models.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/models.js)). These specialized models accept an existing video as input and apply transformations such as watermark removal, style transfer, or enhancement. When calling this method, you must provide a `video_url` parameter pointing to the source video, which the method maps to the appropriate payload field—either `video_url` or a custom field defined by the specific model configuration.

### GenerateVideo: Creating New Content

Conversely, `generateVideo` targets **video generation** models accessed through `getVideoModelById`. This workflow creates entirely new video assets from textual descriptions and optional seed images rather than modifying existing files. The primary input is a text `prompt`, with additional parameters like `aspect_ratio`, `duration`, `resolution`, and `quality` controlling the output characteristics.

## Input Parameters and Payload Construction

The methods diverge significantly in how they assemble request payloads before submission to their respective endpoints.

**ProcessV2V** constructs a minimal payload focused on the video source:

```javascript
const videoField = modelInfo?.videoField || 'video_url';
const finalPayload = { [videoField]: params.video_url };

```

This dynamic field assignment allows specific V2V models to override the default field name while maintaining a consistent developer interface.

**GenerateVideo** builds a more complex payload with conditional optional fields:

```javascript
const finalPayload = {};
if (params.prompt) finalPayload.prompt = params.prompt;
if (params.image_url) finalPayload.image_url = params.image_url;
// …additional optional fields added similarly

```

Both methods resolve their API endpoints using their respective model getters, with `processV2V` using the V2V model's endpoint and `generateVideo` using the Video model's endpoint.

## Asynchronous Processing Implementation

Despite handling different media workflows, both methods share identical asynchronous execution patterns implemented in [`src/lib/muapi.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/muapi.js). After submitting requests to their resolved endpoints, each method invokes `pollForResult(requestId, key, 900, 2000)`, which polls the API for up to 900 seconds (15 minutes) at 2000ms intervals. 

While V2V transformations typically require longer processing times due to frame-by-frame analysis and modification, both operations utilize the same polling infrastructure. Upon completion, each method returns an object containing the API result data plus a `url` property pointing to the processed or newly generated video file.

## Code Examples

### Processing Existing Video with processV2V

When working with V2V models such as watermark removers, pass the source video URL and model identifier:

```javascript
import { muapi } from '@/lib/muapi';

const result = await muapi.processV2V({
  model: 'watermark-remover',
  video_url: 'https://example.com/input.mp4',
  onRequestId: (id) => console.log('Request ID:', id)
});

console.log('Processed video URL:', result.url);

```

This implementation requires the `video_url` parameter and demonstrates the optional callback for tracking the asynchronous request ID before retrieval.

### Generating New Video with generateVideo

For creating fresh content from text descriptions and optional configuration:

```javascript
import { muapi } from '@/lib/muapi';

const result = await muapi.generateVideo({
  model: 'flux-dev-video',
  prompt: 'A futuristic city at sunrise, flying cars in the sky',
  aspect_ratio: '16:9',
  duration: 8,
  resolution: '720p',
  quality: 'high',
  onRequestId: (id) => console.log('Request ID:', id)
});

console.log('Generated video URL:', result.url);

```

This example highlights the primary `prompt` parameter alongside optional fields that control aspect ratio, duration, and output quality.

## Summary

- **`processV2V`** transforms existing videos using V2V models retrieved via `getV2VModelById` in [`src/lib/models.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/models.js), requiring a `video_url` input and constructing payloads with dynamic field mapping based on `modelInfo.videoField`.
- **`generateVideo`** creates new videos from text prompts using video generation models via `getVideoModelById`, accepting `prompt` as the primary input with optional parameters like `image_url`, `aspect_ratio`, and `duration`.
- Both methods reside in [`src/lib/muapi.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/muapi.js), utilize `pollForResult(requestId, key, 900, 2000)` for up to 15 minutes of asynchronous polling, and return result objects containing the final video URL.
- The helper functions in [`src/lib/models.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/models.js) parse model configurations (referencing [`models_dump.json`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/models_dump.json)) to determine appropriate endpoints, input specifications, and field mappings for each workflow type.

## Frequently Asked Questions

### Can I use generateVideo to edit an existing video?

No, `generateVideo` is designed exclusively for creating new videos from text prompts and optional seed images. To modify or transform existing video content, you must use `processV2V`, which specifically handles video-to-video transformations using models that accept a source video URL as input.

### What happens if I provide a video URL to generateVideo?

The `generateVideo` method constructs its payload around text-based parameters and does not recognize `video_url` as a standard input field. While the underlying API might ignore unknown parameters, the video source would not be processed; use `processV2V` instead to ensure proper handling by a V2V-capable model.

### Do both methods support the same polling timeout duration?

Yes, according to the implementation in [`src/lib/muapi.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/muapi.js), both methods call `pollForResult(requestId, key, 900, 2000)`, configuring a maximum polling duration of 900 seconds (15 minutes) with 2000ms intervals between checks.

### Where are the model configurations defined for these methods?

Model configurations are managed in [`src/lib/models.js`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/src/lib/models.js), which provides `getV2VModelById` for video-to-video workflows and `getVideoModelById` for generation workflows. These functions reference the model catalog (defined in [`models_dump.json`](https://github.com/Anil-matcha/Open-Generative-AI/blob/main/models_dump.json)) to resolve endpoints, input field mappings, and model-specific parameters required by each method.