简体   繁体   中英

Streaming audio from the browser to a node.js server with a specific MIME type

What I need: Streaming live audio from the browser to a node.js server in WAV format.

Sounds fairly simple - The Problem: Using getUserMedia you get the audio-stream BUT in audio/webm format. The node.js server is connected to a speech-to-text engine(deepspeech) which CAN ONLY process the stream in WAV format.

What already works: I can already record a fixed length WAV audio blob (via RecorderJs ) and send that finished recording to the node.js server and get its stream from readFileSync server side. Repository here (master working only). But I don't have a fixed recording anymore and want to live-stream that audio continuously.

As of now I am unsure if that is within the possibilities of node.js or any existing library. I've looked into ffmpeg , but didn't find a way to change the encoding of a stream with that. I was only able to change the encoding of a fixed file/blob with ffmpeg.

I'd appreciate it if someone could lead me into the right direction so I know where to start.

FFmpeg is the way to go.

I've looked into ffmpeg, but didn't find a way to change the encoding of a stream with that.

Use - for the input file, and - for the output file. Then use STDIN/STDOUT streams on your Node.js child process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM