2

I'd like to capture the audio and video from a WebRTC stream to a file or pair of files, if audio and video require their own individual files. The audio and video are not muxed together and are known to be available on a set of server udp ports:

Port   Encoding
5000 - VP8 video
5001 - RTCP (for video)
5002 - Opus audio @48kHz 2 channels
5003 - RTCP (for audio)

The SDP file / data is not available and DTLS may be used.

I would prefer to use avconv or ffmpeg to capture the stream, unless a better tool is suggested.

Edit: I've found that this as inquired will most likely not work. Until I hear otherwise, none of these tools support the initial DTLS handshake followed by the data transmission via SRTP.

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131
  • Problem with WebRTC is that everything is encrypted using DTLS so without building/using a whole middle tier do decode it then you are out of luck. There isn't a way that I know of to turn DTLS off to inspect everything. – bond Oct 19 '14 at 01:12

1 Answers1

1

Gstreamer-1.0 pipeline would work just fine. I am not 100% sure on muxing the two streams back together but I believe it is possible(maybe with oggmux). I have tested something similar to this and was able to decode and play the streams on a linux device receiving the decrypted/demuxed rtp streams through a gateway(I use the Janus-Gateway).

gst-launch-1.0 rtpbin name=rtpbin udpsrc name=videoRTP port=5000 \
    caps="application/x-rtp, media=video, encoding-name=VP8-DRAFT-IETF-01, payload=100" ! \
    rtpbin.recv_rtp_sink_0 rtpbin. ! rtpvp8depay ! webmmux ! queue ! filesink location=video.webm sync=false async=false \
    udpsrc name=videoRTCP port=5001 ! rtpbin.recv_rtcp_sink_0 \
    udpsrc name=audioRTP port=5002 \
    caps="application/x-rtp, media=audio, clock-rate=48000, encoding-name=X-GST-OPUS-DRAFT-SPITTKA-00, payload=96" ! \
    rtpbin.recv_rtp_sink_0 rtpbin. ! rtpopusdepay ! oggmux ! filesink location=audio.ogg sync=false async=false \
    udpsrc name=audioRTCP port=5003
Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41
  • Does this handle the DTLS handshake and SRTP data? – Paul Gregoire Nov 20 '14 at 11:23
  • The Janus-Gateway does handle the DTLS handshake and allows the unencrypted and demuxed RTP/RTCP packets to be accessed. There are [custom Gstreamer plugins](https://github.com/EricssonResearch/openwebrtc-gst-plugins) that I have not messed with that were developed by Ericsson Research for their OpenWebRTC platform but I have not experimented with that framework. – Benjamin Trent Nov 20 '14 at 13:51