"Error video stream"

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 like 8554 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:

  1. Verified the URL and port: The stream works on VLC and QGroundControl, but OpenCV seems to have an issue.
  2. Tried different ports and stream configurations in BlueOS.
  3. Checked network connection and IP address: Everything is correct, and my PC is properly connected to the BlueROV2 network (ping test works fine).
  4. 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()

Hi @seatech83 -
Welcome to the forums! :partying_face:

You’re likely unable to access the stream with python because it is already open - do you have QGC or VLC running when trying to access?
Are you trying to access from a topside computer?