In order to compile you need the following packages:
- GCC/G++ compiler 4.9 or newer
- C and C++ standard libraries
- GLib 2.42 or newer (https://wiki.gnome.org/Projects/GLib)
- Avahi 0.6 or newer (https://github.com/lathiat/avahi)
- GStreamer 1.4 or newer (https://gstreamer.freedesktop.org/)
- GStreamer RTSP Server 1.4 or newer (https://gstreamer.freedesktop.org/modules/gst-rtsp-server.html)
- Python2
The following commands should install many of these required packages on Ubuntu:
$ sudo apt-get install libavahi-client-dev libavahi-core-dev libavahi-glib-dev
$ sudo apt-get install gstreamer-1.0
$ sudo apt-get install libgstreamer-plugins-base1.0-dev
$ sudo apt-get install libgstrtspserver-1.0-dev
$ sudo pip2 -q install -U future
We currently depend on mavlink C library which is generated by the build system during compilation. The corresponding submodule should be fetched.
$ git submodule update --init --recursive
Build system follows the usual configure/build/install cycle. Configuration is needed to be done only once. A typical configuration is shown below:
$ ./autogen.sh && ./configure \
--sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib64 \
--prefix=/usr
By default systemd integration is enabled. In a system without systemd it can be disabled --disable-systemd. The default systemd system directory is taken via pkg-config. To use another directory update the above path, use --with-systemdsystemunitdir.
Installation location can be changed using --prefix option while configuring.
Build:
$ make
Install:
$ make install
$ # or... to another root directory:
$ make DESTDIR=/tmp/root/dir install
Camera streaming daemon is composed of a single binary that can be run without any aditional parameter:
$ csd
Currently there are no Ground Control System with full support for Camera Streaming Daemon MAVLink advertisement, but there are 2 straightforward ways to test the daemon, using a WIP implementation in QGroundControl or camera-sample-mavlink-client sample.
There is a QGroundControl branch, still under development, but functional on Linux, to discovery Camera Streaming Daemon streams and play them.
In order to use it, clone the repository located at https://github.com/otaviobp/qgroundcontrol/tree/csd_mavlink_support:
$ git clone -b csd_mavlink_support https://github.com/otaviobp/qgroundcontrol.git
And build it, following the instructions in QGroundControl website: http://qgroundcontrol.org/dev/build_qgc_new
This modified version of QGroundControl adds an option called "MAVLink Auto Discovery Streams" another option to "VideoSource" ComboBox in General Settings panel.
[[images/qgc1.png|alt=QGroundControl Video Settings]]
As soon as this option is selected, information and options about the video is loaded in "Video Streaming Widget", accessible in the Widgets menu (Widgets->Video Streaming).
[[images/qgc2.png|alt=QGroundControl Video Streaming Widget]]
In Video Streaming widget, select the desired video stream and, optionally the resolution. The video will start playing in Video Area automatically.
In camera-streaming-daemon samples repository there is one sample to list all drone's video stream found. The first step to build the samples:
$ make samples
And then in a computer connected to the target drone using WiFi or any other Ethernet connection:
$ ./samples/camera-sample-mavlink-client
More information about the camera-sample-mavlink-client is located in [[samples|Samples#camera-sample-mavlink-client]] wiki page.
Currently there are no Ground Control System with full support for Camera Streaming Daemon, but there are 2 straightforward ways to test the daemon, using a WIP implementation in QGroundControl or camera-sample-client sample + vlc.
There is a QGroundControl branch, still under development, but functional on Linux, to discovery Camera Streaming Daemon streams and play them.
In order to use it, clone the repository located at https://github.com/otaviobp/qgroundcontrol/tree/camera-streaming-daemon-support:
$ git clone -b camera-streaming-daemon-support https://github.com/otaviobp/qgroundcontrol.git
And build it, following the instructions in QGroundControl website: http://qgroundcontrol.org/dev/build_qgc_new
This modified version of QGroundControl adds an option called "Zeroconf Cameras" another option to "VideoSource" ComboBox in General Settings panel.
[[images/qgc1.png|alt=QGroundControl Video Settings]]
As soon as this option is selected, information and options about the video is loaded in "Video Streaming Widget", accessible in the Widgets menu (Widgets->Video Streaming).
[[images/qgc2.png|alt=QGroundControl Video Streaming Widget]]
In Video Streaming widget, select the desired video stream and, optionally, format and resolution. The video will start playing in Video Area automatically.
In camera-streaming-daemon samples repository there is one sample to list all drone's video stream found. The first step to build the samples:
$ make samples
And then in a computer connected to the target drone using WiFi or any other Ethernet connection:
$ ./samples/camera-sample-client
camera-sample-client will list all discovered streams in an output like:
(main_sample_client.cpp:110) Camera Streaming Client
(main_sample_client.cpp:48) Service resolved: '/video0' (rtsp://192.168.1.1:8554/video0)
(main_sample_client.cpp:51) TXT: ["name=Integrated_Webcam_HD"
"frame_size[0]=MJPG(848x480,960x540,1280x720)"]
In order to play the discovered stream, copy the video URI and open it using the vlc video player (or any other video player that supports rtsp):
$ vlc rtsp://192.168.1.1:8554/video0
VLC will start streaming your video.
It's possible to use a .conf file to set custom options for Camera Streaming Daemon. By default, csd looks for a file /etc/csd/main.conf. File location can be overriden via CSD_CONF_FILE environment variable, or via -c switch when running csd. An example of conf file can be found on samples/config.sample
Besides default conf file, it's also possible to use a directory in where to put some extra configuration files. Files on such directory will be read in alphabetical order, and can add or override configurations found on previous files.
By default, /etc/csd/config.d is the directory, but it can be overriden via CSD_CONF_DIR environment variable, or via -d switch when running csd.
Pull-requests are accepted on GitHub. Make sure to check coding style with the provided script in tools/checkpatch, check for memory leaks with valgrind and test on real hardware.
In order to avoid seeing a lot of glib and gstreamer false positives memory leaks it is recommended to run valgrind using the followind command: $ GDEBUG=gc-friendly G_SLICE=always-malloc valgrind --suppressions=valgrind.supp --leak-check=full --track-origins=yes --show-possibly-lost=no --num-callers=20 ./csd