# Python access for video stream

**URL:** <https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680>\
**Category:** Companion (Retired)\
**Created:** [November 25, 2024, 4:00pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680 "2024-11-25T16:00:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 25, 2024, 4:00pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/1 "2024-11-25T16:00:17Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/f/fab29f2cc46c1f624f16980082f710be3e23fdfb.png)

Do I have to flash and update the SD drive on the companion as said on this page? [BlueOS Documentation](https://blueos.cloud/docs/latest/usage/installation/)

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [November 25, 2024, 4:57pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/2 "2024-11-25T16:57:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 25, 2024, 5:20pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/3 "2024-11-25T17:20:23Z")

</div>

Hi @tony-white Thanks for your reply!

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

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [November 25, 2024, 5:33pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/4 "2024-11-25T17:33:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 25, 2024, 5:47pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/5 "2024-11-25T17:47:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [November 25, 2024, 6:01pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/6 "2024-11-25T18:01:32Z")

</div>

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](https://bluerobotics.com/learn/upgrading-a-bluerov2-to-blueos/) is likely the best bet, and is quite easy.

---

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 26, 2024, 11:42am UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/7 "2024-11-26T11:42:06Z")

</div>

@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](https://www.ardusub.com/developers/opencv.html) (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.

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [November 26, 2024, 5:03pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/8 "2024-11-26T17:03:56Z")

</div>

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](https://blueos.cloud/docs/latest/usage/advanced/#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?

---

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 26, 2024, 11:39pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/9 "2024-11-26T23:39:25Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![alyssonoliveira](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@alyssonoliveira](https://discuss.bluerobotics.com/u/alyssonoliveira)\
**Post date:** [November 29, 2024, 12:16pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/10 "2024-11-29T12:16:51Z")

</div>

```auto
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:

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

```

But it doesn’t work…

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/13297_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [November 29, 2024, 9:31pm UTC](https://discuss.bluerobotics.com/t/python-access-for-video-stream/18680/11 "2024-11-29T21:31:28Z")

</div>

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