Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@andrewstart/av-encoder

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@andrewstart/av-encoder - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

23

dist/encodeAudio.js

@@ -39,2 +39,5 @@ "use strict";

const defaults = config.audio.default || { opusTargetBitrate: '32k', mp3Quality: '9', mono: false };
if (!defaults.formats) {
defaults.formats = ['opus', 'caf', 'mp3'];
}
const cache = new utils_1.Cache(config.audio.cache || CACHE_FILE);

@@ -54,9 +57,11 @@ await cache.load();

const currentSettings = Object.assign({}, defaults, group, override);
const formats = currentSettings.formats;
delete currentSettings.src;
delete currentSettings.dest;
delete currentSettings.overrides;
delete currentSettings.formats;
const oldSettings = cache.getSettings(file) || currentSettings;
const changed = { opus: false, mp3: false, caf: false };
const changed = { opus: false, mp3: false, caf: false, webm: false };
if (currentSettings.mono != oldSettings.mono) {
changed.opus = changed.caf = changed.mp3 = true;
changed.opus = changed.caf = changed.mp3 = changed.webm = true;
}

@@ -66,2 +71,3 @@ if (currentSettings.opusTargetBitrate != oldSettings.opusTargetBitrate) {

changed.caf = true;
changed.webm = true;
}

@@ -72,3 +78,3 @@ if (currentSettings.mp3Quality != oldSettings.mp3Quality) {

if (await cache.isDifferent(file, cwd, currentSettings)) {
changed.opus = changed.caf = changed.mp3 = true;
changed.opus = changed.caf = changed.mp3 = changed.webm = true;
}

@@ -79,2 +85,3 @@ else {

const targetCaf = targetBase + '.caf';
const targetWebm = targetBase + '.webm';
const targetMp3 = targetBase + '.mp3';

@@ -87,2 +94,5 @@ if (!await fs.pathExists(targetOpus)) {

}
if (!await fs.pathExists(targetWebm)) {
changed.webm = true;
}
if (!await fs.pathExists(targetMp3)) {

@@ -92,3 +102,3 @@ changed.mp3 = true;

}
return Object.keys(changed).filter(k => changed[k]);
return Object.keys(changed).filter(k => changed[k] && formats.includes(k));
});

@@ -106,2 +116,3 @@ for (const file of changed) {

const targetCaf = targetBase + '.caf';
const targetWebm = targetBase + '.webm';
const targetMp3 = targetBase + '.mp3';

@@ -118,2 +129,6 @@ let writes = [];

}
if (file.modes.includes('webm')) {
writes.push(`-c:a libopus -b:a ${settings.opusTargetBitrate} "${targetWebm}"`);
encodes.push('webm');
}
if (file.modes.includes('mp3')) {

@@ -120,0 +135,0 @@ writes.push(`-c:a libmp3lame -q:a ${settings.mp3Quality} "${targetMp3}"`);

2

package.json
{
"name": "@andrewstart/av-encoder",
"version": "2.0.3",
"version": "2.0.4",
"description": "Encodes and compresses audio/video for widely supported web formats",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc