Gstreamer using WHIP

Using Gstreamer to publish RTSP to Dolby.io Real-time Streaming

Gstreamer now supports WHIP, the WebRTC HTTP Ingest Protocol, allowing you to ingest an RTSP stream (and other protocols) in Gstreamer and send WebRTC to your Dolby.io account and viewers for sub-second end-to-end latency at-scale.

We will use the Simple WHIP client which is a WHIP client based on GStreamer for connecting to the RTSP source and ingest it into Dolby.io Real-time Streaming via WHIP.

Set up your RTSP stream for WHIP

Once you have created your Dolby.io Real-time Streaming token label you will need the publishing token and stream name created. If you have not yet created a token, please do so now. To learn how to create a basic token you can read Creating a Basic Token in the How to Broadcast document. You will need to update the sample code with your token and stream name.

Testing your setup

First test if your setup by using a video test GStreamer pipeline.

Note: If you have recording enabled, you will need to add ?codec=h264.
For the example below, if recording is enabled: https://director.millicast.com/api/whip/kxhqovek ?codec=vp8.

./whip-client -u https://director.millicast.com/api/whip/kxhqovek \
-t 09598571d36bc70dd59871be7a322d0fd688d05decbd619db88ced1f780987a7 \
-V "videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! 
    vp8enc deadline=1 ! rtpvp8pay pt=96 ssrc=2 ! queue !
    application/x-rtp,media=video,encoding-name=VP8,payload=96"

If everything is correct, you should see a command output like this:

1573

And if you connect to the viewer, a bouncing ball will be shown:

1444

Publishing an RTSP video only source

Now, to connect to an RTSP source, like an axis camera, you need to replace the GStreamer pipeline for on that connect to the Camera and pass the video data to Dolby.io Real-time Streaming without transcoding.

./whip-client -u https://director.millicast.com/api/whip/kxhqovek \
  -t  09598571d36bc70dd59871be7a322d0fd688d05decbd619db88ced1f780987a7 \
  -V "rtspsrc location=rtsp://98.100.xxx.xxx:5545/axis-media/media.amp latency=0 name=rtsp !
      rtph264depay ! rtph264pay config-interval=-1 !
      application/x-rtp,media=video,encoding-name=H264"

Publishing an RTSP audio and video source

If your camera also supports audio, you just need to add the GStreamer audio pipeline:

./whip-client -u https://director.millicast.com/api/whip/kxhqovek \
  -t 09598571d36bc70dd59871be7a322d0fd688d05decbd619db88ced1f780987a7 \
  -A "rtsp. ! decodebin ! audioconvert ! audioresample !
      audiobuffersplit output-buffer-duration=2/50 ! queue ! opusenc !
      rtpopuspay pt=100 ssrc=1 ! queue !
      application/x-rtp,media=audio,encoding-name=OPUS,payload=100" \
  -V "rtspsrc location=rtsp://98.100.xxx.xxx:5545/axis-media/media.amp latency=0 name=rtsp !
      rtph264depay ! rtph264pay config-interval=-1 !
      application/x-rtp,media=video,encoding-name=H264"

Publishing an RTSP source with authentication

And finally, if your setup requires authentication, pass the username and password to the GStreamer RTSP plugin

./whip-client -u https://director.millicast.com/api/whip/kxhqovek \
    -t 09598571d36bc70dd58971be7a322d0fd688d05decbd619db88ced1f780987a7 
    -A "rtsp. ! decodebin ! audioconvert ! audioresample ! 
      audiobuffersplit output-buffer-duration=2/50 ! queue ! opusenc !
      rtpopuspay pt=100 ssrc=1 ! queue ! 
      application/x-rtp,media=audio,encoding-name=OPUS,payload=100" \
  -V "rtspsrc location="rtsp://admin:[email protected]:855/live latency=0 name=rtsp 
      user-id=admin user-pw=admin ! rtph264depay ! rtph264pay config-interval=-1 ! 
      application/x-rtp,media=video,encoding-name=H264"