Skip to content

Video thumbnail converter

Variants images for thumbnail video are generates by fluent-ffmpeg. Make sure you have ffmpeg installed on your system (including all necessary encoding libraries like libmp3lame or libx264).

It is possible to specify the path of binaries. Useful if your installations are specific or if you are dropping off precompiled versions.

Installation required:

sh
npm install fluent-ffmpeg
sh
pnpm install fluent-ffmpeg
sh
yarn add fluent-ffmpeg

Configuration

typescript
// config/attachment.ts
export default defineConfig({
  converters: [
    { 
      key: 'preview',
      converter: () => import('@jrmc/adonis-attachment/converters/video_thumbnail_converter'),
    }
  ]
})

By default, image format is PNG and size is video size. options attribute use image_converter

Sample:

typescript
export default defineConfig({
  converters: [
    { 
      key: 'preview',
      converter: () => import('@jrmc/adonis-attachment/converters/video_thumbnail_converter'),
      options: {
        format: 'jpeg',
        resize: 720
      }
    }
  ]
})