• Documentation
  • NEED HELP?
  • Documentation
  • NEED HELP?

Dragonfly

home/Documentation/Dragonfly
Expand All Collapse All
  • Introduction
  • Architectures
  • Requirements
    • Dragonfly Kit
    • Enviroment
  • Create your account
  • Install Dragonfly
    • Install on Ubuntu
    • Install on Windows 10
    • Install on Windows 10 Pro (inside WSL)
  • Launch Dragonfly
    • Launch on Ubuntu
    • Launch on Windows 10
    • Launch on Windows 10 Pro (inside WSL)
  • Configure Dragonfly
    • Configuration parameters
    • Connect the camera
      • USB camera
      • Remote USB camera
      • Raspberry Pi camera
      • Drone's camera
      • Smartphone/tablet camera
      • IP cameras
      • Other video streams
    • Calibrate the camera
      • Monocular cameras
      • Stereoscopic cameras
    • Configure the Camera field Of View (FOV)
  • Use Dragonfly
    • Mount the camera
    • Perform the mapping
    • Perform the geo-referencing
    • Retrieve the positions
    • Display the positions
  • Heatmaps and analytics
  • Maps management
  • API
  • Update Dragonfly
  • Licenses
  • Knowledge Base / FAQs

Remote USB camera

1023 views 4

Any USB camera connected to a machine running Ubuntu or Windows (from now on the SOURCE machine) can be used as a remote USB camera that streams the video over a wireless connection to a different computing unit that runs Dragonfly (from now on the CLIENT machine).

PLEASE READ

  • If you are interested in how to configure a USB camera directly connected to the Dragonfly machine please go to this page.
  • If the 2 machines do not belong to the same local network then you have to setup a port forwarding on the CLIENT machine!

1 – On Ubuntu

1.1 – Install Gstreamer

We use Gstreamer to stream the video from the SOURCE machine. To install it, enter the following commands on your SOURCE machine:

sudo apt-get -y install libgstreamer1.0-dev
sudo apt-get -y install libgstreamer-plugins-base1.0-dev
sudo apt-get -y install gstreamer1.0-libav
sudo apt-get -y install gstreamer1.0-plugins-bad
sudo apt-get -y install gstreamer1.0-tools
sudo apt-get -y install gstreamer1.0-plugins-good
sudo apt-get -y install gstreamer1.0-plugins-ugly
sudo apt-get -y install gstreamer1.0-nice

1.2 – Activate the streaming

On the SOURCE machine:

  1. Connect the USB camera.
  2. Launch the following command to list all video devices picked up by Ubuntu in order to find the ID of the USB camera:
    sudo apt-get install v4l-utils
    v4l2-ctl --list-devices
    Why do you see 2 IDs for each camera?
    There is a common bug on Ubuntu 18.04 where 2 indexes are displayed for each USB camera. When configuring the Camera source field inside the Configuration tab of the Dragonfly Web user interface, please use the first index of the two.
  3. Launch one of the following commands to activate the video stream (ip_SOURCE is the local IP address of the SOURCE machine and port_SOURCE is the port number that you would like to assign to gstreamer):
    • MJPEG streaming – use this solution if the hardware does not allow live H264 encoding, or if H264 is not satisfying:
      gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! decodebin name=dec ! queue ! videoconvert ! jpegenc ! queue ! multipartmux ! tcpserversink host=ip_SOURCE port=port_SOURCE
    • H264 streaming – much lower bandwidth requirements than MJPEG, but requires live encoding and some CPUs might not be powerful enough.
      gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! x264enc tune=zerolatency byte-stream=true ! rtph264pay ! gdppay ! tcpserversink host=ip_SOURCE port=port_SOURCE sync=false
    • H264 (accelerated) streaming – same as H264 streaming, but does not require a powerful CPU encoding. However, all platforms are not compatible. Raspberry Pi and Jetson Nano should work fine.
      gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! omxh264enc ! rtph264pay ! gdppay ! tcpserversink host=ip_SOURCE port=port_SOURCE sync=false

1.3 – Make the video stream available to Dragonfly

  1. Launch Dragonfly on the CLIENT machine.
  2. Click on the Configuration tab:
    1. Set the Camera source parameter to one of the following strings, depending on the type of streaming activated on the SOURCE machine (ip_SOURCE is the local IP of the SOURCE machine and port_SOURCE is the port number assigned to the gstreamer on the SOURCE machine):
      • For MJPEG streaming:
        gstreamer:tcpclientsrc host=ip_SOURCE port=port_SOURCE ! multipartdemux ! image/jpeg, framerate=30/1 ! jpegparse ! jpegdec ! videoconvert ! appsink sync=false
      • For H264 streaming:
        gstreamer:tcpclientsrc host=ip_SOURCE port=port_SOURCE ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! appsink sync=false
      • For H264 (accelerated) streaming:
        gstreamer:tcpclientsrc host=ip_SOURCE port=port_SOURCE ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! appsink sync=false
  3. Click on Save and Restart.

2 – On Windows

2.1 – Install Gstreamer

We use Gstreamer to stream the video from the SOURCE machine. To install it, enter the following commands on your SOURCE machine:

Download Gstreamer from this link:

  • Gstreamer MinGW Runtime

Launch the setup, and during the installation process:

  • select CUSTOM.
  • click on “GStreamer 1.0” and choose “ENTIRE FEATURES WILL BE INSTALLED ON LOCAL DRIVE“.
  • take note of the location where Gstreamer will be installed (e.g. C:\gstreamer\). You will need it later.

Add Gstreamer to the environment variables. To do so:

  1. In Search, start typing “Environment Variables” and then click on it.
  2. Click the Advanced system settings link.
  3. Click Environment Variables.
  4. In the section System Variables find the Path environment variable and select it. Click Edit. If the Path environment variable does not exist, click New.
  5. In the Edit System Variable (or New System Variable) window, insert the path to the gstreamer executable. Assuming an installation of Gstreamer is inside C:\gstreamer\ then the path to add will have to be this:
    • C:\gstreamer\1.0\mingw_x86_64\bin
  6. Click OK. Close all remaining windows by clicking OK.

2.2 – Activate the streaming

On the SOURCE machine:

  1. Connect the USB camera.
  2. In Search, start typing “Device Manager” and then click on it.
  3. Under the CAMERA area please take note of the name associated to the USB camera of interest (this will be your camera_name):
    • Example: “HD USB Camera”
  4. Open the command prompt and type the following command to activate the video stream (ip_CLIENT is the local IP address assigned to the CLIENT machine and port_SOURCE is the port number that you would like to assign to gstreamer on the SOURCE machine):

    gst-launch-1.0.exe -v ksvideosrc device-name="camera_name" ! "image/jpeg,width=640,height=480" ! rtpjpegpay ! udpsink host=ip_CLIENT port=port_SOURCE
    

2.3 – Make the video stream available to Dragonfly

  1. Launch Dragonfly on the CLIENT machine.
  2. Click on the Configuration tab:
    1. Set the Camera source parameter to the following string (port_SOURCE is the port number that is assigned to gstreamer on the SOURCE machine):

      gstreamer:udpsrc port=port_SOURCE ! application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegparse ! jpegdec ! videoconvert ! appsink
  3. Click on Save and Restart.

Was this helpful?

4 Yes  No

Onit Group srl
Sede Legale (Register Office):
Via dell’Arrigoni n° 308, 47522 – Cesena (FC) – Italy
Tel: +39 0547 313110

P.IVA: 03240560403 – C.F.: 04057301006 FC
REA: 292006 – SDI: T04ZHR3
Privacy/cookies

© Onit Group srl – All Rights Reserved