3

I am designing an application which aim is to stream video (with audio) from camera (mobile application) and save it on the disk (on the the server). Everything with the communication between client and server is ok. I am using WebRTC. One of the peers is the server. I just met one problem. The object that I receive via the API is MediaStream. And now the question is how to save video (with sound) to a file from this MediaStream. I know I have to use fs.createWriteStream, but I don't know how to convert MediaStream to use the createWriteStream function. I am using wrtc for WebRTC API.

Brad
  • 159,648
  • 54
  • 349
  • 530
Pear Team
  • 31
  • 2
  • You want to record server-side or client-side? – Brad Jan 08 '19 at 16:02
  • Client connects to server via WebRTC (the second peer is the server). Then client streams video and audio. I want to save stream as a file. – Pear Team Jan 08 '19 at 16:36
  • Yeah, but *where do you want to save it*? Client-side or server-side? – Brad Jan 08 '19 at 17:39
  • On server-side. – Pear Team Jan 08 '19 at 18:10
  • 1
    As far as I know, MediaRecorder isn't implemented in any Node.js library. You'll have to use GStreamer. It has its own WebRTC implementation with access to the underlying stream data. https://github.com/centricular/gstwebrtc-demos As an alternative, you could do something nasty with hacking the SDP and setting up FFmpeg instances to listen for the raw RTP streams. Should be doable, but I haven't gotten that working. Honestly what I've done in the past is just run Chromium and use the built-in MediaRecorder. It's ridiculous, but works, is easy, and compatible. – Brad Jan 08 '19 at 18:15
  • @Brad can you give more info on using chromium to do that? Everything about webRTC is so confusing that would be nice to have something that works, is easy and compatible as you said =] – Jonathan Jun 01 '20 at 18:18

0 Answers0