Mike-Dax / gatsby-plugin-ffmpeg

A Gatsby ffmpeg plugin, for local statically transcoded video. Used on https://electricui.com
MIT License
4 stars 7 forks source link

Usage example? #1

Closed axe312ger closed 5 years ago

axe312ger commented 5 years ago

Hey @Mike-Dax,

thanks for your work. I wonder how to use your plugin, can you please give us an example, how to use it? Copy paste of a working query would help a lot already :)

Best, Benedikt

Mike-Dax commented 5 years ago

Hey @axe312ger,

This plugin just contains a function to queue and transcode files, you're probably looking for the newly created transformer plugin here:

https://github.com/Mike-Dax/gatsby-transformer-ffmpeg

That lets you execute a query...

{
  allVideoFfmpeg {
    edges {
      node {
        id
        webm: transcode(outputOptions: ["-crf 20", "-b:v 0"], maxWidth: 900, maxHeight: 480, fileExtension: "webm", codec: "libvpx-vp9") {
          width
          src
          presentationMaxWidth
          presentationMaxHeight
          originalName
          height
          aspectRatio
        }
        mp4: transcode(maxWidth: 900, maxHeight: 480, fileExtension: "mp4", codec: "libx264") {
          width
          src
          presentationMaxWidth
          presentationMaxHeight
          originalName
          height
          aspectRatio
        }
      }
    }
  }
}

... to transcode video files, which then can be used 'anywhere in your site'.

Alternatively if you have markdown blog entry type stuff, you can use...

https://github.com/Mike-Dax/gatsby-remark-videos

...and that will let you reference videos in your markdown and they'll be automatically transcoded and included.

I've updated the readme to make this clearer.