4

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)
Community
  • 1
  • 1
Madis Nõmme
  • 1,264
  • 2
  • 15
  • 25

2 Answers2

3

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

igracia
  • 3,543
  • 1
  • 18
  • 23
  • I have to sort to the second option: asking only for microphone from ```getUserMedia``` (i.e. constraints ```{video: false, audio: true}``` ) because the user can be confused when he expects audio only call and camera access is being requested. And it seems to be bug in the Kurento *WebRtcEndpoint* or *RecorderEndpoint* because recording video+audio works as does video only. When requesting only micophone, then recording file stays at size 0 and no errors are reported. Will report issue to Kurento google group. – Madis Nõmme Jul 16 '15 at 11:03
  • Started discussion about the bug on kurento google group: https://groups.google.com/forum/#!topic/kurento/iIxcmd76C4E – Madis Nõmme Jul 16 '15 at 11:52
  • 1
    You should, in any case, set the media profile in the recorder and connect with the most explicit type of media profile in the `connect`method. Have you checked that? – igracia Jul 16 '15 at 11:54
  • I did. Used MediaType.AUDIO when sending audio stream only and tried using MediaType.AUDIO also when sending video+audio from browser. Did not work in either case - recording file stayed empty. – Madis Nõmme Jul 16 '15 at 12:00
  • Ok, then it looks like we have a bug in KMS5. One last thing, since we released the new version (KMS6) yesterday, would be to check against that. The only thing is that you'll need to adapt to trickle ICE. – igracia Jul 16 '15 at 12:31
  • We just released the whole thing yesterday, tutorials and everything. Check that and see if you still have that problem. – igracia Jul 17 '15 at 12:15
  • @MadisNõmme Did you try this? Used also the MediaProfileSpecType? – igracia Aug 03 '15 at 14:03
  • Yes I did and it works with Kurento 6. I added a comment to the google group thread too. https://groups.google.com/d/msg/kurento/iIxcmd76C4E/S6vNi4OKBAAJ – Madis Nõmme Aug 03 '15 at 15:24
  • 2
    @MadisNõmme Thanks, I've edited the post to add the info based on that thread, to highlight the media profile thing. It was there already, but didn't seem obvious I think. – igracia Aug 04 '15 at 09:56
1

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

Rajesh
  • 660
  • 4
  • 12
  • After your suggested change, the *PeerConnection#signalingState* goes into ```stable```. So that's an improvement. Still the recording file produced by *RecorderEndpoint* does not get any data (stays at size zero). Do you have other suggestions? Is there a way to observe error events related to recording? I tried *RecorderEndpoint#addErrorListener* but id didn't report any. – Madis Nõmme Jul 16 '15 at 08:35
  • At this point i am thinking it has to do more with Kurento Stack than anything else. Ideally this should be honored. Unless they forgot to check a condition for disabled stream. Sorry ... Cant think of anything else. – Rajesh Jul 16 '15 at 22:45