I would like to know whether it is possible to check the status of the RTP stream. I’m using the start_remote_stream service to start the streams of multible cameras at the same time and I would like to be able to check which of the streams is currently running. I tried to send a rtp packet and check for a response but this I do not receive any even though the camera is streaming on the defined port.
import socket
camera_ip = '192.168.1.1'
camera_port = 30000
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(2)
# Send an RTP packet to the camera
rtp_packet = b"\x80" + b"\x60" + b"\x00\x00\x00\x00" + b"\x00\x00\x00\x00" + b"\x00\x00\x00\x00"
sock.sendto(rtp_packet, (camera_ip, camera_port))
try:
# Receive a response from the camera
data, addr = sock.recvfrom(1024)
print("Camera is streaming over RTP")
except socket.timeout:
print("Camera is not streaming or connection failed")
# Close the socket
sock.close()