Comments (4)
Not really sure of what you're trying to do. The following code might be helpful. Note that opus doesn't define a binary encoding for the stream so trying to write it to a file as such is probably not something you want.
"use strict";
var lame = require( 'lame' );
var opus = require( 'opus' );
var mp3Decoder = new lame.Decoder();
var opusEncoder = new opus.Encoder( 48000, 2 );
var output = process.stdin.pipe( mp3Decoder ).pipe( opusEncoder );
output.on( 'data', function( packet ) {
console.log( console.log( packet ) );
});
from node-opus.
Ah, well right now I'm attempting to package opus data into an RTP packet, but I'm just trying to get the data from an mp3 file to the opus encoder first, and oh my god thank you. I think this is exactly what I needed.
from node-opus.
Ah, good. Yes. For that the above code should work. The audio data for each opus frame can be read from the output-data packets.
from node-opus.
I'm sorry, it all seems to be working now, but I get very distorted audio on the server. I'm told I'm supposed to be using 20ms frames and I think that might be the issue because I can't find anywhere that I can define that. I tried typing 20 within the frame_size argument area, but apparently that's meant for something different? Do I handle this on my part or is there something I'm missing?
Edit: Nevermind, corrupted packets, bad coding on my part.
from node-opus.
Related Issues (20)
- node-opus not working on Ubuntu HOT 1
- opus.Encoder._pushEncodedBuffer HOT 2
- This project is deprecated
- Int32Value with Node 12 HOT 1
- Need help installing HOT 2
- Normal example for opus.Encoder streams
- "too large buffer" HOT 3
- Node-opus install error HOT 1
- Raspberry pi 4 support? HOT 4
- err: Installing on Windows lead to... HOT 1
- npm i node-opus does not work HOT 3
- problème d'installation de node-opus HOT 1
- node-opus not listed in npm list HOT 1
- was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 72 HOT 2
- Installation failed HOT 3
- Not being to install on OSX HOT 4
- Installation problem with python: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 23: ordinal not in range(128) HOT 1
- Unable to Install on Windows x64 HOT 2
- How to deal with 16-bit vs 8-bit audio and frame_size may be incorrectly named HOT 1
- Can't install module HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-opus.