# Help: BlueROV2 Camera Stream

**URL:** <https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615>\
**Category:** Blue Robotics Software\
**Created:** [July 23, 2019, 2:43pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615 "2019-07-23T14:43:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjh](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cjh](https://discuss.bluerobotics.com/u/cjh)\
**Post date:** [July 23, 2019, 2:43pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/1 "2019-07-23T14:43:47Z")

</div>

Hello,

I am trying to stream the video from the BlueROV2 into Matlab. Is there an ip the camera stream is fed into that I can use, or is there a way to easily stream it to an ip? I’m not sure if I can tap into the stream that’s in qgroundcontrol. I recently also found out about gstreamer. I’m not sure if I can use that to stream the video into Matlab. I’ve been looking into PsychToolbox 3 add-on in Matlab to use with gstreamer, but a simple IP stream would be much more simple it seems. I’ve also been looking into the companion software, and it looks like there should be a stream going somewhere, but every URL I’ve tried hasn’t worked. I’ve been looking at [this post on the forums](https://discuss.bluerobotics.com/t/get-video-in-videolan/1884) but can’t seem to figure it out. I got it working in VLC media player, and I’m currently attempting to integrate my Matlab scripts into that. Basically, I’m not sure which direction to take this, or which would be easiest. If anyone has any advice or tips, I would really appreciate it. Thank you!

---

<div class="post-metadata">

**Author:** ![williangalvani](https://avatars.discourse-cdn.com/v4/letter/w/6f9a4e/32.png) [@williangalvani](https://discuss.bluerobotics.com/u/williangalvani)\
**Post date:** [July 23, 2019, 4:50pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/2 "2019-07-23T16:50:22Z")

</div>

Hello Chris,

Currently our video is implemented by a simple UDP stream of a raw (as in not-encapsulated) H264 stream. This h264 stream is sent to the topside computer at IP 192.168.2.1 and port 5600.  
Is [this](https://www.mathworks.com/help/supportpkg/ipcamera/ip-camera-image-acquisition.html) what you mean by “stream it to an ip”? I believe that relies on loading a RTSP stream, which we currently do not provide.

---

<div class="post-metadata">

**Author:** ![info7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/info7/32/4407_2.png) [@info7](https://discuss.bluerobotics.com/u/info7)\
**Post date:** [July 23, 2019, 5:37pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/3 "2019-07-23T17:37:24Z")

</div>

Are you on Linux?

After some messing around on Ubuntu 18.04 I seem to be able to use the `v4l2loopback` driver to create a fake video device as described here:

[https://blog.sysx.no/2018/02/12/using-an-android-device-as-a-webcam-for-linux/](https://blog.sysx.no/2018/02/12/using-an-android-device-as-a-webcam-for-linux/)

In my case I called my new device `/dev/video8` by passing the `video_nr=N` argument when I loaded the module:

`sudo insmod ./v4l2loopback.ko exclusive_caps=1 video_nr=8`

Then I take my usual gstreamer receiver that listens for UDP packets and replace the last element with `v4l2sink` pointing at the new fake video device:

`gst-launch-1.0 udpsrc port=5600 ! "application/x-rtp, payload=96" ! rtph264depay ! vaapidecodebin ! videoconvert ! video/x-raw ! v4l2sink device=/dev/video8`

With that gstreamer pipeline running, the H.264 stream coming in over UDP is decoded to raw video and is then available to other programs by opening the `/dev/video8` video device.

If Matlab can use a local webcam, this might work.

If you’re on Windows I don’t know how to do it.

I am using a Blue Robotics USB cam streaming from a Raspberry Pi as the UDP video source on port 5600.

---

<div class="post-metadata">

**Author:** ![info7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/info7/32/4407_2.png) [@info7](https://discuss.bluerobotics.com/u/info7)\
**Post date:** [July 23, 2019, 5:45pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/4 "2019-07-23T17:45:12Z")

</div>

EDIT: the latency is pretty bad using `vaapidecodebin` in my pipeline.

It’s much better using `avdec_h264`, but requires a lot more CPU for the reciever/translator.

I don’t know enough about gstreamer to optimize the pipeline for this setup. It might be you don’t need to process things as much in between the `udpsrc` and the `v4l2sink`.

---

<div class="post-metadata">

**Author:** ![cjh](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cjh](https://discuss.bluerobotics.com/u/cjh)\
**Post date:** [July 23, 2019, 6:23pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/5 "2019-07-23T18:23:35Z")

</div>

Thank you for the reply. Currently the laptop we are using is a pretty beefy gaming laptop running windows 10, but I should be able to install Ubuntu on it as long as my employer doesn’t care. I’m going to give this a try tomorrow or some other time this week. Thank you!

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [July 24, 2019, 1:10pm UTC](https://discuss.bluerobotics.com/t/help-bluerov2-camera-stream/5615/6 "2019-07-24T13:10:18Z")

</div>

Hi Daniel,

If you need some help to understand how to create gstreamer pipelines and debug it, you should check [this post](https://patrickelectric.work/blog/2018/streaming-with-gstreamer/) that explains a workflow that may help you.
