Search code examples
kurentofiware-kurento

Cannot connect Kurento KMS to a RTSP Multicast URI


Using Kurento Media Server (KMS) at version 6.6.0 deployed with Docker using the following image from Docker Hub: kurento/kurento-media-server:6.6.0

Tutorial followed: Docs » Kurento Tutorials » Java - Player

KMS Version: 6.6.0

Version: 6.6.0
Found modules:
        Module: 'core' version '6.6.0'
        Module: 'elements' version '6.6.0'
        Module: 'filters' version '6.6.0'

Other libraries versions:

ii  gstreamer1.5-libav:amd64             1.8.2.1~20160909143244.96.g493eee4.trusty  amd64        libav plugin for GStreamer
ii  gstreamer1.5-nice:amd64              0.1.13.1~20160909144510.80.gd9ef50e.trusty amd64        ICE library (GStreamer plugin)
ii  gstreamer1.5-plugins-bad:amd64       1.8.1.1~20160909144557.99.gf836e53.trusty  amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.5-plugins-base:amd64      1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-good:amd64      1.8.1.1~20160909143047.112.g9ee4248.trusty amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-ugly:amd64      1.8.1.1~20160909192513.89.g2685b0f.trusty  amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.5-pulseaudio:amd64        1.8.1.1~20160909143047.112.g9ee4248.trusty amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.5-x:amd64                 1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer plugins for X11 and Pango
ii  kms-core-6.0                         6.6.0.20160909201132.trusty                amd64        Kurento core module
ii  kms-elements-6.0                     6.6.0.20160912112100.trusty                amd64        Kurento elements module
ii  kms-filters-6.0                      6.6.0.20160912114031.trusty                amd64        Kurento filters module
ii  kms-jsonrpc-1.0                      1.1.1.trusty                               amd64        Kurento jsonrpc library
ii  kmsjsoncpp                           1.6.3~20160909143252.40.gd78deb7.trusty    amd64        Kurento jsoncpp library
ii  kurento-media-server-6.0             6.6.0.20160912115811.trusty                amd64        Kurento Media Server
ii  libgstreamer-plugins-bad1.5-0:amd64  1.8.1.1~20160909144557.99.gf836e53.trusty  amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer-plugins-base1.5-0:amd64 1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer libraries from the "base" set
ii  libgstreamer1.5-0:amd64              1.8.1.1~20160909144007.170.g0d6031b.trusty amd64        Core GStreamer libraries and elements
ii  libnice10:amd64                      0.1.13.1~20160909144510.80.gd9ef50e.trusty amd64        ICE library (shared library)

Client libraries

  1. Application Server (Back-end)

    • Language: Java
    • Version: 6.9.0
<dependency>
    <groupId>org.kurento</groupId>
    <artifactId>kurento-client</artifactId>
    <version>6.9.0</version>
</dependency>
  1. Kurento-utils (Front-end)

    • Language: JavaScript (Front-end)
    • Version: 6.9.0 "kurento-utils": "^6.9.0"

When i am trying to connect a "PlayerEndpoint" to an ip camera by RTSP MULTICAST, for example: rtsp://xxxxx:[email protected]?multicast=1

KMS returns the following error:

Log KMS v6.6.0 Connection Kurento IP camera Multicast

Pay special attention to line:

kms2       | 0:04:34.165887894     1 0x7fe214002230 DEBUG                rtspsrc gstrtspsrc.c:7553:gst_rtspsrc_handle_message:<source> timeout on UDP port

I can play RTSP UNICAST streams but not MULTICAST

Also i follow this steps to check if this is not a problem with the network.

  • Try to play the MULTICAST stream on GStreamer using the following command works fine:

gst-launch-1.0 rtspsrc location="rtsp://xxxxx:[email protected]?multicast=1" ! decodebin ! autovideosink

  • Compare the Wireshark frames using GStreamer and Kurento. With GStreamer are not problems but using Kurento it appears that the camera starts to send data to the MULTICAST address but Kurento does not visualize the flow, it gives an "invalid uri" error and executes the TEARDOWN.

Here is the result of Wireshark packages:

Pay attention to the Wireshark trace with protocol IGMPv2, i notice that Kurento is not using this protocol.


Solution

  • Following this documentation:

    https://doc-kurento.readthedocs.io/en/6.9.0/dev/dev_guide.html#add-kurento-repository

    I was able to execute the gst-launch-1.5 command in the following way:

    gst-launch-1.5 rtspsrc location =" rtsp://xxxxx:[email protected]/?multicast=1"! Decodebin! autovideosink

    Then the result was as expected, the video could be played in MULTICAST without problems.

    After this I found the following post:

    How to support multicast network in Docker

    Then I could verify that the error came from Docker, specifically the configuration of its network.

    The solution to this problem is to expose the KMS service in the following way in Docker Compose with:

    network_mode: host

    version: "3.7"
    services:
      kms:
        image: kurento/kurento-media-server:6.9.0
        container_name: kms
        restart: always
        network_mode: host
        environment:
          - GST_DEBUG=2,Kurento*:5