Madis Nõmme
Madis Nõmme

Reputation: 1303

How to modify answer SDP for record audio only with Kurento?

I'm able to record video+audio using Kurento Media Server. I'm having problems with recording audio-only stream. From How to use kurento-media-server for audio only stream? understand that the answer SDP has to be modified.

Currently I'm adding MediaStream with only audio tracks to the PeerConnection. On the server side before sending back answer SDP, I modify it. I tried removing

  1. anything below (including) m=video
  2. anything below (including) a=mid:video

In both cases the browser-side PeerConnection#signalingState stayed in have-local-offer.

What to change in the answer SDP that the media stream would start flowing and Kurento would start recording audio-only stream?

Here's the original answer SDP (that the removals were made from) from WebRtcEndpoint#processoffer:

v=0
o=- 7750769884654864002 0 IN IP4 0.0.0.0
s=Kurento Media Server
c=IN IP4 0.0.0.0
t=0 0
a=group:BUNDLE audio video
m=audio 40192 RTP/SAVPF 111 0
c=IN IP4 10.0.2.15
a=rtpmap:111 opus/48000/2
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:40192 IN IP4 10.0.2.15
a=rtcp-mux
a=ssrc:4125152746 cname:user2534372120@host-b735c5b0
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=mid:audio
a=ice-ufrag:SEV7
a=ice-pwd:BQyTSM0hvTJeqykFZovuBS
a=fingerprint:sha-256 E4:A1:25:2C:53:60:28:F5:C1:94:C6:32:E0:13:81:06:A6:66:77:00:52:C2:D9:93:AF:E4:A0:B3:4D:5C:9C:C3
a=candidate:1 1 UDP 2013266431 10.0.2.15 40192 typ host
a=candidate:2 1 UDP 2013266431 192.168.33.10 44816 typ host
m=video 40192 RTP/SAVPF 100
c=IN IP4 10.0.2.15
b=AS:500
a=rtpmap:100 VP8/90000
a=sendonly
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=rtcp:40192 IN IP4 10.0.2.15
a=rtcp-mux
a=ssrc:1769273725 cname:user2534372120@host-b735c5b0
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=mid:video
a=ice-ufrag:SEV7
a=ice-pwd:BQyTSM0hvTJeqykFZovuBS
a=fingerprint:sha-256 E4:A1:25:2C:53:60:28:F5:C1:94:C6:32:E0:13:81:06:A6:66:77:00:52:C2:D9:93:AF:E4:A0:B3:4D:5C:9C:C3
a=candidate:1 1 UDP 2013266431 10.0.2.15 40192 typ host
a=candidate:2 1 UDP 2013266431 192.168.33.10 44816 typ host

EDIT:

After a suggestion from kurento google group it appears there's no need for modifying the SDP. At least with Kurento 6. I got audio-only working (with both audio-only MediaStream from browser and also audio+video MediaStream from browser). For that (example code in Ruby):

  1. Specify MediaProfileSpecType in RecorderEndpoint builderRecorderEndpoint::Builder.new(@pipeline, location).withMediaProfile(org.kurento.client.MediaProfileSpecType::WEBM_AUDIO_ONLY).build()
  2. Specify MediaType when connecting recorder endpoint (@source is WebRtcEndpoint): @source.connect(@recorder, org.kurento.client.MediaType::AUDIO)

Upvotes: 4

Views: 2926

Answers (2)

igracia
igracia

Reputation: 3541

You have to different options here. I'll assume you have a webrtcEp and a recoderEp

  • Send audio and video from the client, but record only video: You'll be sending both, but have to instruct the recorder to store only audio

    RecorderEndpoint recoderEp = new RecorderEndpoint.Builder(pipeline, "URI_HERE").withMediaProfile(MediaProfileSpecType.WEBM_AUDIO_ONLY).build();
    webrtcEp.connect(recorderEp, MediaProfile.AUDIO);
    
  • Send only audio: Setting the video property of the getUserMediaoptions to false should send only audio. If it doesn't, that means there is a bug in the webrtc endpoint's negotiation in the media server. We have a similar scenario, but only sending video, and it's working. If it doesn't please report that so we can fix it.

EDIT #1: In any case, it is always convenient to specify the type of media that is going to be recorded, or that two endpoint are going to exchange through the connect method, so what is written in the first bullet applies to both.

EDIT #2 You definitely need to specify MediaProfileSpecType when creating the recorder

Upvotes: 3

Rajesh
Rajesh

Reputation: 670

You can put the port of the Video Stream to Zero. That should indicate that the stream is being rejected or disabled from further use during the session.

m=video 0 RTP/SAVPF 100

Upvotes: 1

Related Questions