Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to receive an RTP stream over UDP multicast
QtWS25 Last Chance

How to receive an RTP stream over UDP multicast

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ed-wright
    wrote on last edited by ed-wright
    #1

    Hi Qt Gurus,

    I am attempting to intercept an RTP stream that is coming over ethernet as a UDP multicast stream. I have checked wireshark and the packets are certainly arriving, as well as our previous tool that did the job working. I just cannot get my application to receive the packets. I am doing a multicast join group as you will see in my code and i can confirm that i see that on wireshark and yet nothing.

    Code:

    udpSocket = new QUdpSocket(this);
    QSettings settings(QString("configs/config.ini"), QSettings::IniFormat);
    QString ip = settings.value("sensor1/srcIp", "LocalHost").toString(); // settings.value() returns QVariant
    int port = settings.value("sensor1/port", "5004").toInt(); // settings.value() returns QVariant
    QHostAddress testAddr;
    testAddr.setAddress(ip);
    udpSocket->bind(QHostAddress::AnyIPv4, port, QUdpSocket::ShareAddress);
    udpSocket->joinMulticastGroup(testAddr);
    

    In the configs/config.ini file

    [sensor1]
    srcIp=239.192.1.81
    port=5004
    

    This is the multicast message i see on wireshark:
    Source: 192.168.204.128
    Destination: 224.0.0.2
    Protocol: IGMP
    Info: V3 Membership Report / Join Group 239.192.1.81 for any sources

    Additional Info
    The IP address link is 192.168.204.81
    The IP Multicast Address is 239.192.1.81 on which the link transmits the video
    stream
    The link will use UDP in Layer 4 of the TCP/IP mode
    The link will use RTP
    The RTP packets will be transmitted as UDP datagrams on the multicast address
    The UDP port Number is 5004

    Pablo J. RoginaP 1 Reply Last reply
    0
    • E ed-wright

      Hi Qt Gurus,

      I am attempting to intercept an RTP stream that is coming over ethernet as a UDP multicast stream. I have checked wireshark and the packets are certainly arriving, as well as our previous tool that did the job working. I just cannot get my application to receive the packets. I am doing a multicast join group as you will see in my code and i can confirm that i see that on wireshark and yet nothing.

      Code:

      udpSocket = new QUdpSocket(this);
      QSettings settings(QString("configs/config.ini"), QSettings::IniFormat);
      QString ip = settings.value("sensor1/srcIp", "LocalHost").toString(); // settings.value() returns QVariant
      int port = settings.value("sensor1/port", "5004").toInt(); // settings.value() returns QVariant
      QHostAddress testAddr;
      testAddr.setAddress(ip);
      udpSocket->bind(QHostAddress::AnyIPv4, port, QUdpSocket::ShareAddress);
      udpSocket->joinMulticastGroup(testAddr);
      

      In the configs/config.ini file

      [sensor1]
      srcIp=239.192.1.81
      port=5004
      

      This is the multicast message i see on wireshark:
      Source: 192.168.204.128
      Destination: 224.0.0.2
      Protocol: IGMP
      Info: V3 Membership Report / Join Group 239.192.1.81 for any sources

      Additional Info
      The IP address link is 192.168.204.81
      The IP Multicast Address is 239.192.1.81 on which the link transmits the video
      stream
      The link will use UDP in Layer 4 of the TCP/IP mode
      The link will use RTP
      The RTP packets will be transmitted as UDP datagrams on the multicast address
      The UDP port Number is 5004

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @ed-wright not an expert on multicast but it looks like you're not using the proper address to join the group. This example may help

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • E Offline
        E Offline
        ed-wright
        wrote on last edited by
        #3

        @Pablo-J-Rogina Hi, thanks for your reply, you are correct i put the wrong ip in the post i am actually using 239.192.1.81. Sorry about the mis-information

        :)

        aha_1980A 1 Reply Last reply
        1
        • E ed-wright

          @Pablo-J-Rogina Hi, thanks for your reply, you are correct i put the wrong ip in the post i am actually using 239.192.1.81. Sorry about the mis-information

          :)

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ed-wright

          so does it work now?

          Qt has to stay free or it will die.

          E 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @ed-wright

            so does it work now?

            E Offline
            E Offline
            ed-wright
            wrote on last edited by ed-wright
            #5

            @aha_1980 Not at all, I put the info in the post wrong, not the actual config file i was using. The machine running the code is different to the one im posting here to.

            Thanks for your reply :)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              You might want to take a look at using libVLC and the VLC-Qt project for that use case.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              E 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                You might want to take a look at using libVLC and the VLC-Qt project for that use case.

                E Offline
                E Offline
                ed-wright
                wrote on last edited by
                #7

                @SGaist Thanks for the support, what specifically about libVLC should I use, i have heard of it but not used it previously. I assume it must do multicast UDP of RTP streams or something similar?

                Pablo J. RoginaP 1 Reply Last reply
                0
                • E ed-wright

                  @SGaist Thanks for the support, what specifically about libVLC should I use, i have heard of it but not used it previously. I assume it must do multicast UDP of RTP streams or something similar?

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on last edited by
                  #8

                  @ed-wright said in How to receive an RTP stream over UDP multicast:

                  I assume it must do multicast UDP of RTP streams or something similar?

                  I'm kind of lost at this point. I assume that you want to write a Qt application as a client for some other process (already setup and running) that multicasts the stream since you initially wrote:

                  intercept an RTP stream that is coming over ethernet as a UDP multicast stream

                  So if I'm right, what I'd do is trying running the Qt multicast receiver example and check that it can actually connect to your multicast source. That way you'll have a reference that Qt code can actually connect, and all the values (IP address, port, etc) that actually work.

                  Then for actually displaying the RTP stream you may want to resort on libVLC library as mentioned before. I'm not an expert in this topic, but you may want to check this.

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved