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
.
{
audio: {
cache: "path/to/.cachefile",
default: {
opusTargetBitrate: '32k',
mp3Quality: '9',
mono: true,
},
folders: [
{
src: 'src/sfx/*.wav',
dest: 'assets/sfx',
},
{
src: ['src/sfx/loops/*.wav'],
dest: 'assets/sfx/loops',
opusTargetBitrate: '48k',
mp3Quality: '7'
},
{
src: 'src/vo/**/*.wav',
dest: 'assets/vo',
overrides: {
'src/vo/intro.wav': {
opusTargetBitrate: '48k',
mp3Quality: '7'
}
}
},
],
},
video: {
cache: "path/to/.cachefile",
default: {
quality: 28,
width: 1280,
audioOut: '../audio/vo'
},
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.