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

@andrewstart/av-encoder

v2.0.4

Published

Encodes and compresses audio/video for widely supported web formats

Downloads

18

Readme

av-encoder

Encode & compress audio/video specifically for web.

  • encode-audio: Takes a list of folders of audio files and converts them to .opus, .caf (opus codec), and .mp3.
  • encode-video: Takes a list of folders of video files (currently mp4 & mov) and outputs an mp4 for each, and optionally a .wav audio track.

Installation

npm install @andrewstart/av-encoder

Project Config file

You'll need to create a JSON5 or JSON formatted project config file, with the default name/location being ./ave-config.json5.

{
    // configuration for audio
    audio: {
        // Optional, name a cache file to use instead of the default. This allows only changed files to be rerun in later runs.
        cache: "path/to/.cachefile",
        // default properties for audio encoding, if not specified
        default: {
            // Target bitrate for .opus & .caf VBR in the form "<number>k". Lower is lower quality.
            opusTargetBitrate: '32k',
            // Quality for .mp3 VBR, 0-9 with higher being lower quality.
            mp3Quality: '9',
            // True to force downmixing to mono. False or omit to leave as-is
            mono: true,
        },
        // list of source folders and destinations. Source folders are globs, and destinations can be
        // shared.
        folders: [
            {
                src: 'src/sfx/*.wav',
                dest: 'assets/sfx',
            },
            {
                src: ['src/sfx/loops/*.wav'],
                dest: 'assets/sfx/loops',
                // each folder can have specific encoding properties
                opusTargetBitrate: '48k',
                mp3Quality: '7'
            },
            {
                src: 'src/vo/**/*.wav',
                dest: 'assets/vo',
                // you can also override settings for individual files if so desired
                overrides: {
                    'src/vo/intro.wav': {
                        opusTargetBitrate: '48k',
                        mp3Quality: '7'
                    }
                }
            },
        ],
    },
    // configuration for video is exactly the same as for audio, but with different encoding settings
    video: {
        // Optional, name a cache file to use instead of the default. This allows only changed files to be rerun in later runs.
        cache: "path/to/.cachefile",
        default: {
            // MP4 quality: 0 is lossless, 23 is default, and 51 is worst possible. 18-28 is a sane range.
            quality: 28,
            // Width of the video, to handle resizing. This is required for each video, so you may need to set it
            // individually if you have multiple different sized videos
            width: 1280,
            // If audioOut is set, the video will not have an audio track, which will instead be split out into a
            // .wav file to this location (relative to baseSrc from the video configuration)
            audioOut: '../audio/vo'
        },
        // see above for how folders work
        folders: []
    }
}

Project cache files

Files for audio & video caches to track which files need to be encoded and which don't will be created in your project. .aveaudiocache and .avevidiocache (or your project values) will be created when encoding audio and video, respectively. If your output files are tracked with version control, then these cache files should be tracked as well.