# Convert a video clip to an animated GIF

**Use case:** 

Turns a part of a video link into an animated GIF of up to 30 seconds, with the width and frame rate you set. This example makes a 5-second GIF from 20 s to 25 s of a 1080p NASA video: 480x270, 12 frames per second, 2,901,175 bytes. $0.001 per started second of GIF; failed files are free.

## Input

```json
{
  "files": [
    "https://images-assets.nasa.gov/video/BalloonAscension_TL_VOTY/BalloonAscension_TL_VOTY~large.mp4"
  ],
  "fileFields": [
    "url"
  ],
  "operation": "gif",
  "start": "20",
  "end": "25",
  "videoFormat": "mp4",
  "resolution": "480p",
  "quality": "balanced",
  "targetSizeMb": 0,
  "maxFps": 0,
  "mute": false,
  "audioFormat": "mp3",
  "audioKbps": 0,
  "channels": "keep",
  "sampleRate": "keep",
  "normalizeLoudness": false,
  "gifWidth": 480,
  "gifFps": 12,
  "frameCount": 5,
  "frameEverySeconds": 0,
  "frameFormat": "jpg",
  "frameWidth": 0,
  "maxFiles": 100,
  "maxMinutesPerFile": 60,
  "maxFileSizeMb": 1024,
  "maxConcurrency": 2
}
```

## Output

```json
{
  "fileIndex": {
    "label": "#",
    "format": "number"
  },
  "url": {
    "label": "Source",
    "format": "link"
  },
  "operation": {
    "label": "Operation",
    "format": "text"
  },
  "status": {
    "label": "Status",
    "format": "text"
  },
  "fileUrl": {
    "label": "Output file",
    "format": "link"
  },
  "format": {
    "label": "Format",
    "format": "text"
  },
  "durationSec": {
    "label": "Seconds",
    "format": "number"
  },
  "width": {
    "label": "Width",
    "format": "number"
  },
  "height": {
    "label": "Height",
    "format": "number"
  },
  "bytes": {
    "label": "Bytes",
    "format": "number"
  },
  "frameTimeSec": {
    "label": "Frame at (s)",
    "format": "number"
  },
  "sourceDurationSec": {
    "label": "Source seconds",
    "format": "number"
  },
  "sourceBytes": {
    "label": "Source bytes",
    "format": "number"
  },
  "note": {
    "label": "Note",
    "format": "text"
  },
  "billable": {
    "label": "Billable",
    "format": "boolean"
  },
  "error": {
    "label": "Error",
    "format": "text"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Video & Audio Converter (FFmpeg): Compress, MP3, GIF, Frames Actor is ready to run with the inputs already set for "Convert a video clip to an animated GIF". [Sign up or log in](https://console.apify.com/create-task-from-example/8JtDykBd8cpA0Kjcr) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Convert a video clip to an animated GIF" task

The Video & Audio Converter (FFmpeg): Compress, MP3, GIF, Frames Actor will start running based on the input automatically. You can also change all the input fields, like files, file link fields, and more, to match your specific use case.

### 3. Receive the "Convert a video clip to an animated GIF" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as #, source, operation, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Convert a video clip to an animated GIF" task via API](https://apify.com/kadben/video-audio-converter.md).

## FAQ

### How long can a GIF from the video to GIF task be?

The video to GIF task uses at most 30 seconds from start. The example takes 20 s to 25 s, so its GIF is 5 seconds long.

### How much does the video to GIF task cost?

The video to GIF task charges $0.001 per started second of GIF: the 5-second example costs $0.005, plus the $0.0002 Apify start event at 4 GB; $0.015 per started 100 MB beyond the first 100 MB. Failed files are free.

### How does the video to GIF task keep colors good?

The video to GIF task builds a palette from the clip first (FFmpeg palettegen and paletteuse), so the 256 GIF colors fit the scene; 10-15 fps keeps files small. The example is 2,901,175 bytes.

## About this Actor

This example demonstrates how to use [Video & Audio Converter (FFmpeg): Compress, MP3, GIF, Frames](https://apify.com/kadben/video-audio-converter.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/kadben/video-audio-converter.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/kadben/video-audio-converter.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
