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

webm-muxer

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webm-muxer - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

64

build/webm-muxer.js

@@ -461,3 +461,6 @@ "use strict";

throw new Error("No video track declared.");
this.writeVideoDecoderConfig(meta);
let internalChunk = this.createInternalChunk(chunk, timestamp);
if (this.options.video.codec === "V_VP9")
this.fixVP9ColorSpace(internalChunk);
this.lastVideoTimestamp = internalChunk.timestamp;

@@ -473,5 +476,8 @@ while (this.audioChunkQueue.length > 0 && this.audioChunkQueue[0].timestamp <= internalChunk.timestamp) {

}
}
writeVideoDecoderConfig(meta) {
if (meta.decoderConfig) {
if (meta.decoderConfig.colorSpace) {
let colorSpace = meta.decoderConfig.colorSpace;
this.colorSpace = colorSpace;
this.colourElement.data = [

@@ -506,2 +512,38 @@ { id: 21937 /* MatrixCoefficients */, data: {

}
fixVP9ColorSpace(chunk) {
if (chunk.type !== "key")
return;
if (!this.colorSpace)
return;
let i = 0;
if (readBits(chunk.data, 0, 2) !== 2)
return;
i += 2;
let profile = (readBits(chunk.data, i + 1, i + 2) << 1) + readBits(chunk.data, i + 0, i + 1);
i += 2;
if (profile === 3)
i++;
let showExistingFrame = readBits(chunk.data, i + 0, i + 1);
i++;
if (showExistingFrame)
return;
let frameType = readBits(chunk.data, i + 0, i + 1);
i++;
if (frameType !== 0)
return;
i += 2;
let syncCode = readBits(chunk.data, i + 0, i + 24);
i += 24;
if (syncCode !== 4817730)
return;
if (profile >= 2)
i++;
let colorSpaceID = {
"rgb": 7,
"bt709": 2,
"bt470bg": 1,
"smpte170m": 3
}[this.colorSpace.matrix];
writeBits(chunk.data, i + 0, i + 3, colorSpaceID);
}
addAudioChunk(chunk, meta, timestamp) {

@@ -631,2 +673,24 @@ this.ensureNotFinalized();

var main_default = WebMMuxer;
var readBits = (bytes, start, end) => {
let result = 0;
for (let i = start; i < end; i++) {
let byteIndex = Math.floor(i / 8);
let byte = bytes[byteIndex];
let bitIndex = 7 - (i & 7);
let bit = (byte & 1 << bitIndex) >> bitIndex;
result <<= 1;
result |= bit;
}
return result;
};
var writeBits = (bytes, start, end, value) => {
for (let i = start; i < end; i++) {
let byteIndex = Math.floor(i / 8);
let byte = bytes[byteIndex];
let bitIndex = 7 - (i & 7);
byte &= ~(1 << bitIndex);
byte |= (value & 1 << end - i - 1) >> end - i - 1 << bitIndex;
bytes[byteIndex] = byte;
}
};
return __toCommonJS(main_exports);

@@ -633,0 +697,0 @@ })();

2

package.json
{
"name": "webm-muxer",
"version": "1.0.7",
"version": "1.0.8",
"description": "WebM multiplexer in pure TypeScript for use with WebCodecs API, video & audio.",

@@ -5,0 +5,0 @@ "main": "./build/webm-muxer.js",

# webm-muxer - JavaScript WebM multiplexer
![](https://img.shields.io/npm/v/webm-muxer)
![](https://img.shields.io/bundlephobia/minzip/webm-muxer)
[![](https://img.shields.io/npm/v/webm-muxer)](https://www.npmjs.com/package/webm-muxer)
[![](https://img.shields.io/bundlephobia/minzip/webm-muxer)](https://bundlephobia.com/package/webm-muxer@1.0.7)

@@ -6,0 +6,0 @@ The WebCodecs API provides low-level access to media codecs, but provides no way of actually packaging (multiplexing)

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