Record webrtc remote stream using RecordRTC

I am using Opentok JavaScript WebRTC to host a 1 to 1 video chat (peer-to-peer). I see my video video and hear the sound impeccably.

My desire is to record audio / video of other chats (deleted). For this purpose I use RecordRTC . I managed to record the video of another chat participant (the video is output to the HTML video element), but so far I have not been able to record the sound (WAV file with dead silence as far as I could get). Using Chrome Canary (30.0.1554.0). This is my method:

var clientVideo = $('#peerdiv video')[0];//peer video (html element) var serverVideo = $('#myselfdiv video')[0];//my video (html element) var context = new webkitAudioContext(); var clientStream = context.createMediaStreamSource(clientVideo.webRTCStream); var serverStream = context.createMediaStreamSource(serverVideo.webRTCStream); 

webRTCStream is a custom property assigned to the HTMLVideoElement object by changing the source of the opentok js library. It contains the MediaStream object associated with the corresponding <video>.

 var recorder = RecordRTC({ video: clientVideo, stream: clientStream }); recorder.recordAudio(); recorder.recordVideo(); 

The video is being recorded. An audio file is also created, the length of which is close to the length of the video, however it is completely silent (and yes, during recording there was a lot of noise on the other side)

I tested this with a video element that displays the video stream (and audio) of the webcam, and it worked: both audio and video were recorded:

 ... var recorder = RecordRTC({ video: serverVideo, stream: serverStream }); ... 

Is there anything special about streams originating from a remote location? Any advice on this would be very helpful.

+7
webrtc web-audio opentok
source share
3 answers

This same problem occurs in the following situations ...

  • If there is no stereo audio (two-channel sound) ... i.e. this is mono audio
  • If the audio input channels are not equal to the audio outputs
  • If the audio input device is not selected by default on chrome

I am still trying to find the actual problem.

I added this experiment for testing purposes ... see console ...

https://webrtc-experiment.appspot.com/demos/remote-stream-recording.html

Updated at: Saturday, February 1, 2014 09:22:04 PKT

Remote sound recording is not supported; and this problem is considered as a low priority wontfix:

Updated March 28, 2016

Remote recording of audio + video is now supported in RecordRTC, since the version of Chrome is 49 + .

Firefox, on the other hand, can simply record remote sound.

+7
source share

If Chrome / WebRTC / Opus displays monophonic sound by default, and if this is a problem, I see two options in this case:

  • Using opus stereo output - not sure how.
  • Writing RecordRTC / Recorderjs code with mono

Or does anyone know of any other recording library that works?

+2
source share

This actually works great in Firefox. I am using FireFox 29.0.1 , and AudioAPI can now work with audio stream sources captured by remote parties from a peer-to-peer connection.

To check the transition to the Muaz Khan experiment page . I'm not sure which version of Firefox has rolled out, but I would like to thank the team for scrolling it!

Chrome error was moved to AudioAPI cr error command to track progress

0
source share

All Articles