Python access for video stream

I am trying to connect to blueOS using 192.168.2.2:2770/network on my browser but it refuses to connect.

I can access it with ssh and was even able to mannualy set different ports for the camera and get the output on QGC:

Do I have to flash and update the SD drive on the companion as said on this page? BlueOS Documentation

Hi @alyssonoliveira -

It seems you’re not running BlueOS, but the very old Companion software!

The :2770/network is from the previous Companion software and will not load any aspect of BlueOS…

The changes you mention making are likely more appropriate to be modified via the BlueOS web interface, you can find this at 192.168.2.2 or blueos.local.
This will only be available once you hav flashed your SD card with the latest BlueOS version, as the link you shared instructs.

1 Like

Hi @tony-white Thanks for your reply!

But shouldn’t I be able to access the old Companion software?

Hi @alyssonoliveira -
Yes, Companion should load at 192.168.2.2.:2770
If you can’t reach this, your computer has not been configured to have an IP of 192.168.2.1 / 255.255.255.0 subnet mask, or some other issue is present.
Updating is a good idea, as we have not supported Companion for quite some time, and there are many advantages to BlueOS.

It doesn’t load, unfortunately. My computer is configured properly because I can ping the ROV, access it through QGC, and send MAVLink commands.

My problem is getting the camera video stream outside of QGC. That’s why I’m trying to access the Companion software to get some insight into what’s happening. I’ll look into updating the software. Thanks anyway.

Hi @alyssonoliveira -
You may want to try clearing your browser cache or using another browser?
I’m only aware of VLC as a solution for getting camera streams outside of QGC, can you share more about your goals?
An update is likely the best bet, and is quite easy.

@tony-white hey!

I’m trying to retrieve the video signal using OpenCV and GStreamer, but I’ve been stuck on this for a week.

I accessed the ROV files using SSH (beucase I can’t do it through my browser) and modified a file called video_start.sh to create a gstreamer multiudpsink for two different ports: 4777 and 5600 (as suggested on ArduSub’s page). On QGC I could read the signal from both ports but outside of it, no success.

I have tried:

  • VLC’s Network Stream
  • Gstreamer command line (no variation opens a display or indicates receiving packages; I could only open a test display)
  • Python code (from ArduSub’s page).

Regarding my Python code, I’m running it in a docker container on Windows because I needed to build OpenCV with Gstreamer on the backend. It could be a network issue with the container’s IP, so I tried changing it. I was able to ping 192.168.2.1 (my computer), but not 192.168.2.2 (BlueROV2).

I also ran simpler Python scripts to try accessing ports 4777 or 5600 with QGC closed, but still no sucess (while writing this, I realized I could run them outside the container since they don’t need Gstreamer, I might try that to see if the problem is the container’s network).

Well, that’s basically the whole story. My ultimate goal is to develop some autonomous control functions for the ROV along with CV functionalities.

Hi @alyssonoliveira -

From your description, I would almost guarantee you’re facing a docker network issue of some kind? If you can’t ping the ROV Pi from the terminal, then you’re not going to be able to receive a video stream from that IP!
I am also confused that your web browser doesn’t open up the Companion interface- but generally we’re not going to be able to give you much assistance as long as the system is running Companion, which we no longer support…
If you are running BlueOS, the Video Streams page should make it a cinch to configure the stream as an RTSP (rather than UDP) output, which may be able to receive with Gstreamer?

1 Like

@tony-white Hi! Thanks again!
I’m on a tight schedule right now, but if I manage to find some time, I’ll try the update and share the results here.
In WCC, I’ll just remove this part of the project and focus on movement commands.

Thank you!

raspivid --nopreview \
         --mode 5 \
         --bitrate 15000000 \
         --intra 1 \
         --awb auto \
         --brightness 55 \
         --saturation 10 \
         --sharpness 50 \
         --contrast 15 \
         --drc medium \
         -roi 0.02,0.0,0.81,0.85 \
         -fl \
         --timeout 0 \
         --output - | \
         gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! \
         multiudpsink clients=192.168.2.1:5600,192.168.2.1:4777

This is how BlueROV2 is sending the video to QGC. QGC can get video from both ports but I can’t.

I’m tried to use something like this just to test:

import cv2
udp_address = "udp://192.168.2.2:5600"
cap = cv2.VideoCapture(udp_address)

But it doesn’t work…

Hi @alyssonoliveira -
Try using udp://0.0.0.0:5600 instead - this means accept UDP packets at port 5600 on any interface.