PHPackages                             spacecatninja/imager-x-video-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. spacecatninja/imager-x-video-adapter

ActiveCraft-plugin[Image &amp; Media](/categories/media)

spacecatninja/imager-x-video-adapter
====================================

Imager X file adapter for extracting and transforming images from videofiles using ffmpeg

1.1.0(2y ago)0521MITPHPPHP ^8.0.2

Since Jun 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/spacecatninja/craft-imager-x-video-adapter)[ Packagist](https://packagist.org/packages/spacecatninja/imager-x-video-adapter)[ RSS](/packages/spacecatninja-imager-x-video-adapter/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

Imager X Video Adapter plugin for Craft CMS
===========================================

[](#imager-x-video-adapter-plugin-for-craft-cms)

A plugin for extracting and transforming images from videos using Imager X.
Also, an example of [how to make a custom file adapter for Imager X](https://imager-x.spacecat.ninja/extending.html#file-adapters).

Requirements
------------

[](#requirements)

This plugin requires Imager X 4.1+/5.0+, Craft CMS 4.0+/5.0+, PHP 8.0+ and [a working ffmpeg installation](https://ffmpeg.org/download.html).

Installation
------------

[](#installation)

To install the plugin, follow these instructions:

1. Install with composer via `composer require spacecatninja/imager-x-video-adapter` from your project directory.
2. Install the plugin in the Craft Control Panel under Settings → Plugins, or from the command line via `./craft install/plugin imager-x-video-adapter`.

---

Usage
-----

[](#usage)

Install and configure the adapter as described below.

You can now extract frames simply by adding a video file to Imager's `transformImage` method:

```
{% set transform = craft.imagerx.transformImage(myVideoAsset, { width: 200 }) %}

```

You can pass configuration parameters to the adapter, using the `adapterParams` transform parameter:

```
{% set transform = craft.imagerx.transformImage(myVideoAsset, { width: 200, adapterParams: { time: '50%' } }) %}

```

You can also create the adapter as a separate step, with the advantage of being able to better control settings, and inspecting the video.

```
{% set video = craft.videoadapter.load(asset, { format: 'png' }) %}

Video duration: {{ video.getDuration() }}

{% do video.setTime(video.getDuration()/2) %}
{% set thumbAtCenter = craft.imagerx.transformImage(video, { width: 600 }) %}

```

### Caveat regarding time

[](#caveat-regarding-time)

Sync issues have always plagued video manipulation, and this plugin is no exception. If you try to extract "the last frame" of a video, for instance by passing in `100%` to the `time` parameter, you'll most likely get an error. Even if you've used `video.getDuration()` and pass that in, ffmpeg most often won't be able to extract a frame.

The only solution is backing up half a second or so, which will usually get you a usable frame.

### Auto generation

[](#auto-generation)

The video adapter works perfectly with the [auto generation functionality](https://imager-x.spacecat.ninja/usage/generate.html)in Imager X. The only thing you need to do, is add the video file extensions that the video adapter is configured to register for (see `addFileFormats` below), to the list of safe file formats to transform, using the config setting ['safeFileFormats'](https://imager-x.spacecat.ninja/configuration.html#safefileformats-array).

```
'safeFileFormats' => ['jpg', 'jpeg', 'gif', 'png', 'mp4', 'mov', 'avi']

```

Configuring
-----------

[](#configuring)

You can configure the adapter by creating a file in your config folder called `imager-x-video-adapter.php`, and override settings as needed.

### ffmpegConfig \[array\]

[](#ffmpegconfig-array)

Default: `[]`
Under the hood, this adapter uses the excellent [PHP-FFMPEG](https://github.com/PHP-FFMpeg/PHP-FFMpeg)library. It tries to auto-detect your ffmpeg and ffprobe installation, and have reasonable defaults. But if it isn't able to detect your runtimes, you'll need to configure it manually.

This config setting takes an array which is passed directly to [FFMpeg/FFProbe's create method](https://github.com/PHP-FFMpeg/PHP-FFMpeg#ffmpeg). Here's an example with all the available settings:

```
'ffmpegConfig' => [
    'ffmpeg.binaries'     => '/usr/local/bin/ffmpeg',
    'ffprobe.binaries'    => '/usr/local/bin/ffprobe',
    'timeout'             => 3600, // The timeout for the underlying process
    'ffmpeg.threads'      => 12,   // The number of threads that FFMpeg should use
    'temporary_directory' => '/var/ffmpeg-tmp'
]

```

### defaultFormat \[string\]

[](#defaultformat-string)

Default: `'jpg'`
Sets the default format of the temporary bitmap image that the adapter generates. You can of course transform this to whatever format you'd like later, using Imager.

### defaultTime \[int|float|string\]

[](#defaulttime-intfloatstring)

Default: `'25%'`
Sets the default time in the video that the thumbnail should be extracted from. It can be either an integer or float value representing seconds, or a string with a percentage value of the relative time in the video.

### addFileFormats \[array\]

[](#addfileformats-array)

Default: `['mp4','mov','avi']`
Specifies the file extensions that should be added to use this adapter when passed to Imager. Make sure that any file formats added, can actually be used by your ffmpeg installation.

### cacheEnabled \[bool\]

[](#cacheenabled-bool)

Default: `true`
Enables/disables caching of generated images. Only disable this if testing, as it will seriously impact performance.

### cacheDuration \[bool|int\]

[](#cacheduration-boolint)

Default: `false`
Sets the cacheDuration that's used if `cacheEnabled` is `true`. By default, forever. Clearing the Imager runtime cache will also clear this cache.

---

Price, license and support
--------------------------

[](#price-license-and-support)

The plugin is released under the MIT license. It requires Imager X, which is a commercial plugin [available in the Craft plugin store](https://plugins.craftcms.com/imager-x).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~602 days

Total

2

Last Release

823d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/806fbb515be53ddbca1d658f1abe7f8ddd41d77b72eec8aa85800db3a03e7e35?d=identicon)[spacecatninja](/maintainers/spacecatninja)

---

Top Contributors

[![aelvan](https://avatars.githubusercontent.com/u/2675644?v=4)](https://github.com/aelvan "aelvan (2 commits)")

---

Tags

videocmsCraftcraftcmscraft-pluginimager

### Embed Badge

![Health badge](/badges/spacecatninja-imager-x-video-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/spacecatninja-imager-x-video-adapter/health.svg)](https://phpackages.com/packages/spacecatninja-imager-x-video-adapter)
```

###  Alternatives

[spacecatninja/imager-x

Ninja powered image transforms.

29390.0k23](/packages/spacecatninja-imager-x)[nystudio107/craft-transcoder

Transcode video &amp; audio files to various formats, and provide video thumbnails

437.8k1](/packages/nystudio107-craft-transcoder)[doublesecretagency/craft-googlemaps

Maps in minutes. Powered by the Google Maps API.

1267.9k](/packages/doublesecretagency-craft-googlemaps)[nystudio107/craft-youtubeliveembed

This plugin allows you to embed a YouTube live stream and/or live chat on your webpage

163.7k](/packages/nystudio107-craft-youtubeliveembed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
