Sending a mixed audio stream on the same transport and record

I have an audio router mixing solution that is currently sending opus packets via MediaRecorder and piping to ffmpeg.

I’m entertaining the idea of sending the audio track to mediasoup and send that specific transport to ffmpeg.

Is it possible to send a second track on the same producer transport.

producerTransport.produce(audioParams);

And then how to obtain that rtp stream so ffmpeg can send to another server ?

Of course you can call produce() many times in same transport. Please read the API docs. This is clearly documented.

Do you mean handling that extra track for sending to ffmpeg is in the server side api ? I don’t want it showing up as a second track on consumer side if that is what it does.

Then please rephrase your question using proper mediasoup terminology because you literally asked if produce() can be called 2 times in same transport.

I don’t know what language you expect me to say it in. It’s quite obvious. A second audio mixed MediaStream from an audio api mixer. Or do I need to create a second producer for that one stream ?

This demo is similar to what I’m trying to achieve and already doing with a pipe method. But it references to the producer id. Unless I can specify a track ? It just needs to be one audio track sent to ffmpeg.

I don’t know what an audio api mixer is and I don’t know what the first audio stream is (you are just talking about a second one). But anyway: 1 Producer == 1 media stream track, and 1 Consumer == 1 media stream track.