Open prostosergey opened 4 years ago
I'm trying to pass the 'raw' audio-stream from fd: to nodejs sox-stream, but transcode result are always empty, without any warn/errors messages ((
stream = fs.createReadStream(null, {fd: 3, autoClose: false }); var transcode = sox({ global: { guard: true, 'no-dither': true, norm: true, temp: '/tmpfs' }, input: { type: 'raw', 'ignore-length': true, encoding: 'signed-integer', bits: 16, rate: 8000, channels: 1 }, output: { type: 'raw' }, }); var dest = fs.createWriteStream('/tmpfs/song.raw'); stream.pipe(transcode).pipe(dest);
But if I divide into 2 operations, all is well:
// 1 - 'from fd: to file'
stream.pipe(dest);
// 2 - 'from file to transcode'
var src = fs.createReadStream('/tmpfs/song.raw'); src.pipe( transcode ).pipe(dest2);
Why sox-stream doesn't work with file descriptor (only with file) ? How to make it work? Thank you!
I recommend copying the index.js file contents and pasting it into your project. Then maybe change this line to var tmpFile = fs.createReadStream(...) and see if that works.
index.js
var tmpFile = fs.createReadStream(...)
I'm trying to pass the 'raw' audio-stream from fd: to nodejs sox-stream, but transcode result are always empty, without any warn/errors messages ((
But if I divide into 2 operations, all is well:
// 1 - 'from fd: to file'
stream.pipe(dest);
// 2 - 'from file to transcode'
Why sox-stream doesn't work with file descriptor (only with file) ? How to make it work? Thank you!