Ingesting RTSP in Millicast with WHIP

Millicast supports WHIP ingest allowing you to publish an RTSP stream to your Millicast account and viewer.

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 Millicast via WHIP.

Set up your RTSP stream for Whip

Once you have created your Millicast 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

./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:

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

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 Millicast 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"

Did this page help you?