1.0.0 • Published 4 years ago

@cofenster/nexrender-action-encode-assets v1.0.0

Weekly downloads
1
License
-
Repository
-
Last release
4 years ago

Action: Encode

Encode all videos found by wildcard 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

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",
                "ffmpeg": "../ffmpeg",
                "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 or wildcard of the file(s) you want to encode, can be either relative or absulte path. Defaults to current job output video file.
  • ffmpeg optional argument, path to load the ffmpeg module from or save to if none found. can be absolute or ralative to workpath.
  • 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

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`,
}