# Streaming Multiple USB Cameras at Once

**URL:** <https://discuss.bluerobotics.com/t/streaming-multiple-usb-cameras-at-once/10479>\
**Category:** Companion (Retired)\
**Created:** [August 25, 2021, 1:52am UTC](https://discuss.bluerobotics.com/t/streaming-multiple-usb-cameras-at-once/10479 "2021-08-25T01:52:28Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 9, 2021, 8:22am UTC](https://discuss.bluerobotics.com/t/streaming-multiple-usb-cameras-at-once/10479/6 "2021-09-09T08:22:30Z")

</div>

**EDIT:** this comment applies to Companion 0. The new [BlueOS](https://discuss.bluerobotics.com/t/companion-1-0-beta-testing/10830) uses a different camera manager, and supports multiple h264 camera streams without modification.

* * *

This took longer to get back to than I’d hoped, and you might already have a working solution for your use case, but in case it’s relevant I spent some time on it today, so now have an approach that makes it easy to add extra videos. The relevant code changes are here:

> **[Comparing bluerobotics:master...ES-Alexander:video-N · bluerobotics/companion](https://github.com/bluerobotics/companion/compare/master...ES-Alexander:video-N)**
>
> Companion computer startup scripts and examples. Contribute to bluerobotics/companion development by creating an account on GitHub.

After that, adding extra video streams basically just requires creating the two extra parameter files for each one, and adding a line for it in `.companion.rc`. As an example, for a second BR camera the H264 access is likely at `/dev/video3`, and if we want we can stream it to port 5610 (the default stream goes to 5600), so to add that you’d make

#### vidformat-extra.param

```auto
1920
1080
30
/dev/video3

```

#### gstreamer-extra.param

```auto
! h264parse
! queue
! rtph264pay config-interval=10 pt=96
! udpsink host=192.168.2.1 port=5610

```

and change `.companion.rc` to have

```auto
	...
	sudo -H -u pi screen -dm -S video $COMPANION_DIR/tools/streamer.py vidformat.param gstreamer2.param
	sudo -H -u pi screen -dm -S video2 $COMPANION_DIR/tools/streamer.py vidformat-extra.param gstreamer-extra.param
	...

```

And then the receiving end can be handled as in the post I linked you to in my first comment. More streams can be added in the same way, making sure to select the correct device in the vidformat parameters and set a unique port in the gstreamer ones.

* * *

@UnderseaROV If you’re still working with this stuff, this approach might be worth considering 🙂

---

_[View the full topic](https://discuss.bluerobotics.com/t/streaming-multiple-usb-cameras-at-once/10479)._
