npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nexrender/action-encode

v1.46.8

Published

Encode your video to a specified format using built-in ffmpeg utility. You don't need to have ffmpeg installed on your system.

Downloads

5,179

Readme

Action: Encode

Encode your video to a specified format using built-in ffmpeg utility. You don't need to have ffmpeg installed on your system.

Installation

If you are using binary version of the nexrender, there is no need to install the module, it is included in the binary build.

npm i @nexrender/action-encode -g

The module downloads a statically defined version of ffmpeg and places it into /temp/nexrender folder (by default). If you have ffmpeg installed on your system already, you can provide an env variable to use it:

$ NEXRENDER_FFMPEG=/usr/bin/ffmpeg nexrender-cli ...

Usage

When creating your render job provide this module as one of the postrender actions:

// job.json
{
    "actions": {
        "postrender": [
            {
                "module": "@nexrender/action-encode",
                "output": "foobar.mp4",
                "preset": "mp4",
                "params": {"-vcodec": "libx264", "-r": 25}
            }
        ]
    }
}

Information

  • output is a path on your system where result will be saved to, can be either relative or absulte path.
  • input optional argument, path of the file you want to encode, can be either relative or absulte path. Defaults to current job output video file.
  • preset optional argument, if provided will be used as a preset for the renderer, if not, will take input directly from params
  • params optional argument, object containing additional params that will be provided to the ffmpeg binary

Params (optional)

Params are passed as an object of key-value pairs. In case of a param without value, you can provide null or empty string "" as a value. Eg. {"-vcodec": "libx264", "-r": 25, "-an": null} would end up as -vcodec libx264 -r 25 -an in the final ffmpeg command.

// job.json
{
    "actions": {
        "postrender": [
            {
                "module": "@nexrender/action-encode",
                "output": "foobar.mp4",
                "preset": "mp4",
                "params": {
                    "-vcodec": "libx264", 
                    "-r": 25,
                    "-an": null, // disable audio
                }
            }
        ]
    }
}

Presets

There are a couple of default presets included with the build. You can provide params field to override any of the values there.

mp4

{
    '-acodec': 'aac',
    '-ab': '128k',
    '-ar': '44100',
    '-vcodec': 'libx264',
    '-r': '25',
}

ogg

{
    '-acodec': 'libvorbis',
    '-ab': '128k',
    '-ar': '44100',
    '-vcodec': 'libtheora',
    '-r': '25',
}

webm

{
    '-acodec': 'libvorbis',
    '-ab': '128k',
    '-ar': '44100',
    '-vcodec': 'libvpx',
    '-b': '614400',
    '-aspect': '16:9',
}

mp3

{
    '-acodec': 'libmp3lame',
    '-ab': '128k',
    '-ar': '44100',

}

m4a

{
    '-acodec': 'aac',
    '-ab': '64k',
    '-ar': '44100',
    '-strict': '-2',
}

gif

{
    '-i': input,
    "-ss": '61.0',
    "-t": '2.5',
    "-filter_complex": `[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse`,
}