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

# Extend Video Example

> Extend videos using AI to continue and extend your content seamlessly

## Overview

Extend Video uses Veo 3.1 AI to intelligently continue and extend your videos. Perfect for creating longer content, extending storytelling sequences, and optimizing video length.

## Basic Extension (8 seconds)

```javascript theme={null}
const response = await fetch('https://api.hooked.so/v1/project/create/extend-video', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.HOOKED_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Extended Story Video',
    media: 'media_video123',
    prompt: 'The camera slowly zooms out revealing a beautiful sunset over the ocean',
    targetDuration: 8,
    generateAudio: true
  })
});

const data = await response.json();
console.log('Video ID:', data.data.videoId);
console.log('Project ID:', data.data.projectId);
```

## Medium Extension (16 seconds)

```javascript theme={null}
const extendVideoMedium = async () => {
  const response = await fetch('https://api.hooked.so/v1/project/create/extend-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Extended Story Video',
      media: 'media_product_demo',
      prompt: 'The product rotates smoothly as the background transitions from blue to purple with subtle particle effects',
      targetDuration: 16,
      generateAudio: true,
      webhook: 'https://yoursite.com/webhook',
      metadata: {
        campaignId: 'q1-product-launch',
        platform: 'youtube',
        targetAudience: 'tech-enthusiasts'
      }
    })
  });

  return await response.json();
};
```

## Long Extension (32 seconds)

```javascript theme={null}
const extendVideoLong = async () => {
  const response = await fetch('https://api.hooked.so/v1/project/create/extend-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Extended Story Video',
      media: 'media_story_video',
      prompt: 'The scene continues with smooth camera movement, transitioning through different environments while maintaining visual consistency',
      targetDuration: 32, // Processed in 4 segments of 8 seconds
      generateAudio: true,
      webhook: 'https://yoursite.com/webhook',
      metadata: {
        campaignId: 'storytelling-2024',
        type: 'narrative'
      }
    })
  });

  return await response.json();
};
```

## Marketing Video Extension

```javascript theme={null}
const extendMarketingVideo = async () => {
  const response = await fetch('https://api.hooked.so/v1/project/create/extend-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Extended Story Video',
      media: 'media_ad_clip',
      prompt: 'The camera pulls back to show the full product lineup as the brand logo fades in with a golden glow effect',
      targetDuration: 12,
      generateAudio: true,
      webhook: 'https://yoursite.com/webhook/video-complete',
      metadata: {
        campaignId: 'q1-product-launch',
        platform: 'youtube',
        targetAudience: 'tech-enthusiasts'
      }
    })
  });

  return await response.json();
};
```

***

## Tips for Extend Video

<Tip>**Specific prompts**: Be detailed about camera movement, lighting changes, and object behavior</Tip>
<Tip>**Match the source**: Reference the style and mood of your source video in the prompt</Tip>
<Tip>**Start small**: Test with 8-16 seconds first, then scale to longer durations</Tip>
<Tip>**Audio consistency**: Enable generateAudio for smooth audio transitions</Tip>
<Tip>**Duration multiples**: Target duration must be a multiple of 4 seconds</Tip>

***

## Duration Guide

Choose the right extension duration for your use case:

| Duration | Use Case                        | Processing Time |
| -------- | ------------------------------- | --------------- |
| 4-8s     | Quick transitions, social clips | 2-3 minutes     |
| 12-16s   | Short scene extensions          | 4-6 minutes     |
| 20-32s   | Medium storytelling sequences   | 8-12 minutes    |
| 36-60s   | Long-form content extensions    | 15-20 minutes   |

***

## Handling the Webhook Response

```javascript theme={null}
// Express.js webhook handler
app.post('/webhook', (req, res) => {
  const { data, status, message } = req.body;

  if (status === "COMPLETED") {
    const { videoId, url, shareUrl, metadata } = data;
    console.log('Video extended successfully!');
    console.log('Video ID:', videoId);
    console.log('Download URL:', url);
    console.log('Share URL:', shareUrl);
    console.log('Original Duration:', metadata.originalDuration);
    console.log('Extended Duration:', metadata.extendedDuration);

    // Save to your database, notify user, etc.
  } else if (status === "FAILED") {
    console.error('Video extension failed:', message);
    // Handle failure, notify user, retry, etc.
  }

  res.status(200).send('OK');
});
```

***

## Common Use Cases

* **Content Creation**: Extend short clips into longer, more engaging content
* **Storytelling**: Continue narrative sequences with AI-generated footage
* **Marketing**: Create extended product demos and promotional videos
* **Social Media**: Optimize video length for platform requirements
* **B-Roll Generation**: Generate additional footage that matches your style
* **Video Loop Creation**: Extend videos to create seamless loops

***

## Prompt Examples by Category

### Camera Movement

* "The camera continues to dolly backward, revealing the full scene as it maintains focus on the subject"
* "Smooth pan to the right, discovering new elements in the environment"
* "Gentle zoom in on the product while maintaining the same lighting"

### Transitions

* "The scene gradually transitions from day to night with natural lighting changes"
* "Soft cross-fade into a new environment while maintaining visual continuity"
* "The background shifts from warm tones to cool tones over the duration"

### Action Continuation

* "The dancer completes the spin and strikes a final pose with arms extended"
* "The product rotates a full 360 degrees, showcasing all angles"
* "The character walks toward the horizon as the sun sets behind them"

### Atmospheric Effects

* "Particles begin to float upward as the lighting becomes more dramatic"
* "Rain starts falling gently as the mood becomes more contemplative"
* "Fog rolls in from the sides, creating a mysterious atmosphere"
