Replace Audio of existing stream and send via WebRTC or RTMP

Luca

Member
Hi

I was wondering if we are able to do the following

Take an existing stream(from a mixer) and replacing its audio with a local browser microphone and send to an RTMP server

Flow would be:

1. User logs into application and see a video playing the WCS mixer WebRTC stream(this mixer contains streams from another part of the applications)

2. User connects its own microphone, presses a button and the video from the mixer and audio from the user get mixed into a new stream

3. Stream is sent to a server via RTMP

Please let me know
Best
Luca
 

Max

Administrator
Staff member
Good day.
You should use additional mixer to replace an audio:
1. Add video from existing stream to a new mixer:
Code:
POST /rest-api/mixer/add HTTP/1.1
Host: localhost:8081
Content-Type: application/json
  
{
 "uri": "mixer://m1",
 "remoteStreamName": "stream1",
 "hasVideo": "true",
 "hasAudio": "false"
}
2. Add audio from users microphone to this mixer
Code:
POST /rest-api/mixer/add HTTP/1.1
Host: localhost:8081
Content-Type: application/json
  
{
 "uri": "mixer://m1",
 "remoteStreamName": "users_mic",
 "hasVideo": "false",
 "hasAudio": "true"
}
3. Send the mixer m1 stream to a server via RTMP
You should also set the following parameter to prevent a grey box displaying for audio only stream:
Code:
mixer_show_separate_audio_frame=false
Please note that more mixers, more CPU load.
 
Top