Coder Social home page Coder Social logo

mike-dax / gatsby-remark-videos Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 13.0 2.43 MB

Embed html5 style looping videos in your Gatsby site direct from your markdown. Used on https://electricui.com

License: MIT License

TypeScript 100.00%
ffmpeg gatsby gatsbyjs mdx remark

gatsby-remark-videos's People

Contributors

mahrcel avatar mike-dax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gatsby-remark-videos's Issues

Push release to fix readme on gatsby plugin library

Currently the plugin's readme is based on the one on NPM which still has the bug that there was some missing commas. Could there be a patch release so the readme showing up on the gatsby plugin library doesn't have the broken example.

Add option to disable optimizations for development

So when developing it would be great to disable ffmpeg compression/optimizations since they take quite long. I already use a function to differ from hard compression and low compression but ffmmpeg tasks still take very long on huge files.

Is there a way to add controls to the video?

Hello, thank you for creating your plugin, I find it very helpful.

One question: I can't see a way to add controls to the videos created by the plugin, apparently, there are none.

I'd like to make

Getting: 'Error: Unable to find plugin "gatbsy-remark-videos". Perhaps you need to install its package?'

I am trying to implement this plugin to work with my self hosted videos. Currently getting 'Error: Unable to find plugin "gatbsy-remark-videos". Perhaps you need to install its package?' error during plugin loading. My gatsby-config.js looks like so:

module.exports = {
  plugins: [
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    "gatsby-transformer-remark",
    {
      resolve: `gatsby-remark-copy-linked-files`,
      options: {},
    },
    {
      resolve: "gatsby-plugin-mdx",
      options: {
        extensions: [".mdx", ".md"],
        gatsbyRemarkPlugins: [
          {
            resolve: `gatsby-remark-copy-linked-files`,
            options: {},
          },
          {
            resolve: `gatsby-remark-videos`,
            options: {
              pipelines: [
                {
                  name: "vp9",
                  transcode: chain =>
                    chain
                      .videoCodec("libvpx-vp9")
                      .noAudio()
                      .outputOptions(["-crf 20", "-b:v 0"]),
                  maxHeight: 480,
                  maxWidth: 900,
                  fileExtension: "webm",
                },
                {
                  name: "h264",
                  transcode: chain =>
                    chain
                      .videoCodec("libx264")
                      .noAudio()
                      .addOption("-profile:v", "main")
                      .addOption("-pix_fmt", "yuv420p")
                      .outputOptions(["-movflags faststart"])
                      .videoBitrate("1000k"),
                  maxHeight: 480,
                  maxWidth: 900,
                  fileExtension: "mp4",
                },
              ],
            },
          },
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 1200,
              linkImagesToOriginal: false,
            },
          },
        ],
        plugins: [`gatsby-remark-images`, `gatsby-remark-videos`],
      },
    },
    `gatsby-transformer-ffmpeg`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `pages`,
        path: `${__dirname}/src/videos/`,
      },
    },
  ],
}

Any and all help in getting this working or what I am doing wrong is much appreciated. Thank you

Using with gatsby-plugin-mdx results in undefined HTML parent tag

I just added your plugin and it seems to work totally fine but looking at the generated code it seems that it has an undefined parent element. I couldn't find the source where it resolves to undefined.

My repo: https://github.com/muuvmuuv/portfolio (development branch)

I have not uploaded the videos yet, so you must remove the videos in content/projects/additive-tv/index.md and content/projects/influxe-gaming/index.md. After that add a video in one project file.

Bildschirmfoto 2020-03-02 um 21 02 46

Minor issue? A little confused.

First of all thank you for writing this plugin. I have gotten it to work and it is very useful. But I encountered an issue with it and being relatively new, I'm not sure if there's something simple involving the way Gatsby handles its file system...

  • I have my locally stored .mp4 video in the same folder as my markdown file. I reference it in the markdown file as instructed: ! [ ] (filename.mp4).
  • When I compile the project, Gatsby finds the file and saves it to public/static as "filename-long-hash.mp4".
  • gatsby-remark-videos goes to look for a file in public/static called "filename.mp4", but can't find it because it's been changed to "filename-long-hash.mp4", and so the files aren't transcoded.

My work around to this was to look for the name of the file in videoPath, i.e. I replaced:

return file.absolutePath === videoPath;

with

return videoPath.includes(file.absolutePath.slice(0,-4));

on line 72 of index.js.

But I'm guessing this is not really needed. Where should I be putting my .mp4s so that they don't get renamed like this?

Also I don't know if this is a big deal but the plugin will not work when installed into node-modules, because I believe Gatsby plugins require an index.js file in the plugin root. But if you have the plugin in the optional "plugins" directory in the project root, it seems to work fine. This was a problem for me because "npm install " installs into node_modules by default. I guess you could make a no-op index.js file to get around this. I've noticed many other plugins do this.

Sorry if this is a silly issue. Thanks for all your hard work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.