Hello,
I’m encountering an issue when trying to open the video stream from the BlueROV2 via Python using OpenCV. Below are the details:
Error Encountered:
- When running the Python script, the video stream doesn’t open, and I receive the following error:
Error opening video stream.
Stream Details:
- Stream URL used:
udp://192.168.2.1:5600
(default port, but I’ve also tried other ports like8554
without success). - The video stream works correctly on other applications like QGroundControl, but doesn’t display in VLC (the player remains in a loop without showing the video).
What I’ve Tried:
- Verified the URL and port: The stream works on VLC and QGroundControl, but OpenCV seems to have an issue.
- Tried different ports and stream configurations in BlueOS.
- Checked network connection and IP address: Everything is correct, and my PC is properly connected to the BlueROV2 network (ping test works fine).
- Reinstalled OpenCV with
opencv-contrib-python
to ensure video stream compatibility.
here my python script :
import cv2
Video stream URL
video_url = ‘udp://192.168.2.1:5600’
Open the video stream
cap = cv2.VideoCapture(video_url)
if not cap.isOpened():
print(“Error opening video stream”)
exit()
while True:
ret, frame = cap.read()
if not ret:
print(“Error reading frame”)
break
# Display the frame
cv2.imshow('BlueROV2 Video Stream', frame)
# Exit with the 'q' key
if cv2.waitKey(1) & 0xFF == ord('q'):
break
Release resources
cap.release()
cv2.destroyAllWindows()