2
votes

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.

1
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

1 Answers

1
votes

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