How to receive an RTP stream over UDP multicast
-
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 sourcesAdditional 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 -
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 sourcesAdditional 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@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
-
@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
:)
so does it work now?
-
so does it work now?
-
Hi,
You might want to take a look at using libVLC and the VLC-Qt project for that use case.
-
Hi,
You might want to take a look at using libVLC and the VLC-Qt project for that use case.
-
@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?
@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.