@andrewstart/av-encoder
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -90,6 +90,6 @@ "use strict"; | ||
await fs.ensureDir(audioDest); | ||
const audioTarget = path.resolve(audioOut, file.slice(0, -4) + '.wav'); | ||
const audioTarget = path.resolve(audioDest, file.slice(0, -4) + '.wav'); | ||
if (overwrite || !await fs.pathExists(audioTarget)) { | ||
try { | ||
const audioResult = await ffmpeg.run(`-y -i "${path.resolve(srcFolder, file)}" -c:a pcm_f32le "${audioTarget}"`); | ||
const audioResult = await ffmpeg.run(`-y -i "${fileSrc}" -c:a pcm_f32le "${audioTarget}"`); | ||
console.log(`${file} - encoded to wav`); | ||
@@ -96,0 +96,0 @@ if (audioResult) { |
{ | ||
"name": "@andrewstart/av-encoder", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Encodes and compresses audio/video for widely supported web formats", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -7,2 +7,71 @@ # av-encoder | ||
For project config file (`ave-config.json5`), see `config.ts`. | ||
### 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`. | ||
```javascript | ||
{ | ||
// configuration for audio | ||
audio: { | ||
// root folder for all src paths | ||
baseSrc: 'src/audio', | ||
// root folder for all dest paths | ||
baseDest: 'assets/audio', | ||
// 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', | ||
}, | ||
// list of source folders and destinations. Source folders are not recursive, and destinations can be | ||
// shared. | ||
folders: [ | ||
{ | ||
src: 'sfx', | ||
dest: 'sfx', | ||
}, | ||
{ | ||
src: 'sfx/loops', | ||
dest: 'sfx/loops', | ||
// each folder can have specific encoding properties | ||
opusTargetBitrate: '48k', | ||
mp3Quality: '7' | ||
}, | ||
{ | ||
src: 'vo', | ||
dest: 'vo', | ||
// you can also override settings for individual files if so desired | ||
overrides: { | ||
'intro.wav': { | ||
opusTargetBitrate: '48k', | ||
mp3Quality: '7' | ||
} | ||
} | ||
}, | ||
], | ||
}, | ||
// configuration for video is exactly the same as for audio, but with different encoding settings | ||
video: { | ||
baseSrc: 'src/video', | ||
baseDest: 'assets/video', | ||
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` 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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16423
76