# Using Blue Robotics Low LIght USB cameras in ROV system

**URL:** <https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097>\
**Category:** General Discussion\
**Created:** [January 9, 2018, 6:55pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097 "2018-01-09T18:55:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [January 9, 2018, 6:55pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/1 "2018-01-09T18:55:13Z")

</div>

@jwalser I will be using your cameras in an existing system running on either a Pi3 or Jetson TX2. Can you supply drivers for the camera (I reckon it is not plug and play) without referring to the pre-loaded image?  
Also, do we have the possibility to trigger the cameras externally for synchronising multiple cameras?

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [January 9, 2018, 7:01pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/2 "2018-01-09T19:01:51Z")

</div>

The cameras are compliant with the UVC standard. They will work with the v4l2 linux drivers. You will have to write your own program to deal with the camera synchronization, but yes this is possible.

---

<div class="post-metadata">

**Author:** ![Chourizo](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@Chourizo](https://discuss.bluerobotics.com/u/Chourizo)\
**Post date:** [January 11, 2018, 6:19pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/3 "2018-01-11T18:19:30Z")

</div>

Can you show some commands to do it? When I use more than two cameras I get quite a bit of corruption in the videos (pixelation), even with the cameras at 15fps.

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [January 11, 2018, 8:44pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/4 "2018-01-11T20:44:10Z")

</div>

gst-launch-1.0 -v v4l2src device=$DEVICE do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.2.1 port=5600

Change the device, width, height, framerate, and client ip/port as necessary for multiple streams. You should do a bandwidth test because other factors like power supply and cable/connector quality/disrepair can affect video quality.

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [January 31, 2018, 3:05pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/5 "2018-01-31T15:05:25Z")

</div>

Thank you for the snippet. By changing the sink to a filesink I am able to record video to file into a mkv-container. However, when I try to play the files in VLC, it seems there is nothing there even though the file-size is large. Furthermore I added the “-e” in order to end recording correctly from Ctrl+C.  
Any thoughts here?

---

<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:** [January 31, 2018, 4:37pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/6 "2018-01-31T16:37:31Z")

</div>

If you want to record the video, you’ll need to change the pipeline.

> [@New Products! Low-Light HD USB Camera and Bar100 Depth/Pressure Sensor](https://discuss.bluerobotics.com/t/new-products-low-light-hd-usb-camera-and-bar100-depth-pressure-sensor/1447/31):
>
> gst-launch-1.0 -v v4l2src device=$DEVICE do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.2.1 port=5600

This pipeline is used to transmit video using udp and h264.

Now, to save the video as a file to play it in VLC, you will need to encode and compress the video to jpeg into an avi file.  
E.g: `gst-launch-1.0 -v v4l2src device=$DEVICE ! jpegenc ! avimux ! filesink location=video.avi`

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [January 31, 2018, 5:15pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/7 "2018-01-31T17:15:22Z")

</div>

Wow ok, thanks Patrick!  
Since the x264 compression is made on-board the camera, I thought one could simply grab it and slam it into a file. Won’t this increase the filesize enormously?

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [January 31, 2018, 5:29pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/8 "2018-01-31T17:29:37Z")

</div>

@jchr89 You are correct. It should go something like this:

> gst-launch-1.0 -ev v4l2src device=/dev/video1 do-timestamp=true ! video/x-h264, width=1920, height=1080, framerate=30/1 ! h264parse ! mp4mux ! queue ! filesink location=test.mp4

Without the mux you are recording a raw stream with no information about duration and timestamps. Some players will play the raw stream just fine, but seeking won’t work. While @patrickelectric example won’t increase the filesize per-se, it will introduce a lot of computational overhead in re-encoding the video if you are using the H.264 stream (note the camera is capable of mjpeg and h264 output).

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [January 31, 2018, 7:49pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/9 "2018-01-31T19:49:32Z")

</div>

I see, thanks guys.  
Since I will be using a single Raspberry Pi 3 to collect data from 2 of these cameras simultaneously, I think I need to grab the H.264 stream (video1, right?). Not sure the bandwidth is big enough for 2 HD streams otherwise. Not even sure it is big enough even when using the H.264 stream.  
I will try this out at work tomorrow - thanks again!

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 1, 2018, 9:39am UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/10 "2018-02-01T09:39:56Z")

</div>

Just to get back to you and others who might think of doing this. I can confirm that it works with a Raspberry Pi 3 and 2 cameras recording simultaneously in HD.  
I made a bash-script for starting and stopping recording. See below:

```
#!/bin/bash

WIDTH=1920
HEIGHT=1080
FRAMERATE=15
DATE_STAMP=$(date +%Y%m%d)
TIME_STAMP=$(date +%H%M%S)
DATA_PATH="data/$DATE_STAMP"
FILENAME_BOW=$TIME_STAMP"_bow.mp4"
FILENAME_PS=$TIME_STAMP"_ps.mp4"

mkdir -p $DATA_PATH;
cd $DATA_PATH

echo "starting bow video stream"
gst-launch-1.0 -e v4l2src device=/dev/video1 do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! mp4mux ! queue ! filesink location=$FILENAME_BOW &
echo "starting port side video stream"
gst-launch-1.0 -e v4l2src device=/dev/video3 do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! mp4mux ! queue ! filesink location=$FILENAME_PS &

```

and for stopping the recording:

```
#!/bin/bash
echo "stopping video recording"
killall -SIGINT gst-launch-1.0

```

If I would like to stream the video both to a file, as I am doing now, and simultaneously show the video to the display - is this possible by adding more commands to gst-launch?

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [February 1, 2018, 7:27pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/11 "2018-02-01T19:27:16Z")

</div>

It is possible, there are examples to do this in this forum and online. The exact implementation will depend on where (locally or remotely) you want to save and display video.

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 6, 2018, 1:54pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/12 "2018-02-06T13:54:54Z")

</div>

Hi Jacob,

When getting video and saving it to a file as shown above, I get these laggish effects every 15 seconds a so (see uploaded file).  
Other than messing with the pixels it also lags quite a bit. I have replayed the files in VLC on both Ubuntu and Max OS. Any thoughts on this?

 ![00](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/b/be6be10d0180d53c2ddbecdd6921df624f4108a8.jpg)

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [February 6, 2018, 4:14pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/13 "2018-02-06T16:14:15Z")

</div>

You are recording this to the pi sd card? The script is exactly the same as above post?

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 7, 2018, 2:11pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/14 "2018-02-07T14:11:44Z")

</div>

Yes, it is dumped directly on the Raspberry Pi 3 sd card. Script is exactly the same as above, yes.

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [February 8, 2018, 6:55pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/15 "2018-02-08T18:55:56Z")

</div>

What kind of SD card are you using?

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 8, 2018, 7:09pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/16 "2018-02-08T19:09:58Z")

</div>

Some Kingston 64 GB Class 10 Ultra. Can’t remember more details about - will update you tomorrow when I’m at work, if you need it,

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [February 8, 2018, 7:12pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/17 "2018-02-08T19:12:16Z")

</div>

Where did you purchase it? Counterfeits abound.  
I still have yet to try your script myself, but a bottleneck in filesystem I/O is my first idea of the problem.

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 8, 2018, 7:14pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/18 "2018-02-08T19:14:57Z")

</div>

We bought it through our industrial supplier in Denmark, so we should be good 🙂  
Yeah, I am running two concurrent instances (2 cameras to the same Pi) in HD. But “only” at 15 FPS.  
I haven’t tried lowering the resolution though…

---

<div class="post-metadata">

**Author:** ![jchr89](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jchr89](https://discuss.bluerobotics.com/u/jchr89)\
**Post date:** [February 9, 2018, 8:07am UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/19 "2018-02-09T08:07:14Z")

</div>

Jacob, I forgot that I made some extensions to the above script.  
In addition to saving the H.264 stream to a file, I also grab the raw stream and show to display. This is done as shown below:

```
#!/bin/bash

WIDTH=1920
HEIGHT=1080
FRAMERATE=15
DATE_STAMP=$(date +%Y%m%d)
TIME_STAMP=$(date +%H%M%S)
DATA_PATH="data/$DATE_STAMP"
FILENAME_BOW=$TIME_STAMP"_bow.mp4"
FILENAME_PS=$TIME_STAMP"_ps.mp4"

mkdir -p $DATA_PATH;
cd $DATA_PATH

echo "starting bow video stream"
gst-launch-1.0 -e v4l2src device=/dev/video1 do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! mp4mux ! queue ! filesink location=$FILENAME_BOW &
gst-launch-1.0 -e v4l2src device=/dev/video2 ! video/x-raw, format=YUY2, width=640, height=480, framerate=15/1 ! xvimagesink sync=false &
echo "starting port side video stream"
gst-launch-1.0 -e v4l2src device=/dev/video3 do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! mp4mux ! queue ! filesink location=$FILENAME_PS &
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw, format=YUY2, width=640, height=480, framerate=15/1 ! xvimagesink sync=false &

```

And this is what seems to cause I/O problems. I am doing this only because I can’t seem to get the H.264 stream shown on display and simultaneously written to a file.

---

<div class="post-metadata">

**Author:** ![danzimmerman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/danzimmerman/32/2209_2.png) [@danzimmerman](https://discuss.bluerobotics.com/u/danzimmerman)\
**Post date:** [February 15, 2018, 7:03pm UTC](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097/20 "2018-02-15T19:03:00Z")

</div>

I’m trying to use gstreamer to stream from the low-light USB webcam to QGroundControl with the following command:

```auto
gst-launch-1.0 -v v4l2src device=$DEVICE do-timestamp=true ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.1.222 port=5600

```

(already have WIDTH=1920, HEIGHT=1080, FRAMERATE=15, DEVICE=/dev/video1, with video1 verified to be the H.264 source)

It fails quickly with the following error:

```auto
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Video device did not suggest any buffer size.
Additional debug info:
gstv4l2object.c(3417): gst_v4l2_object_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0
Execution ended after 0:00:00.073182406

```

Using Raspbian Jessie on a Raspberry Pi 3 Model B.

(The older version of Raspbian is in play because I hope to install ROS Kinetic)

Any ideas on how to fix this?

[Next page](https://discuss.bluerobotics.com/t/using-blue-robotics-low-light-usb-cameras-in-rov-system/2097.md?page=2)
