Video streaming for Linux based devices.
Works e.g. in conjunction with Parrot Drones where the autopilot is the Paparazzi autopilot. Sends a RTP/UDP stream of the camera image, a.k.a. live video
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="video_rtp_stream">
b'<define name="VIEWVIDEO_CAMERA" value="front_camera|bottom_camera" />\n '
b'<define name="VIEWVIDEO_CAMERA2" value="front_camera|bottom_camera" />\n '
b'<define name="VIEWVIDEO_DOWNSIZE_FACTOR" value="4" />\n '
b'<define name="VIEWVIDEO_QUALITY_FACTOR" value="50" />\n '
b'<define name="VIEWVIDEO_FPS" value="5" />\n '
b'<define name="VIEWVIDEO_USE_RTP" value="TRUE|FALSE" />\n '
b'<configure name="VIEWVIDEO_USE_NETCAT" value="FALSE|TRUE" />\n '
b'<configure name="VIEWVIDEO_HOST" value="192.168.1.255" />\n '
b'<configure name="VIEWVIDEO_PORT_OUT" value="5000" />\n '
b'<configure name="VIEWVIDEO_PORT2_OUT" value="6000" />\n '
b'<configure name="VIEWVIDEO_BROADCAST" value="FALSE|TRUE" />\n\n '
</module>
Module configuration options
Configure Options
- name:
VIEWVIDEO_USE_NETCAT
value: FALSE|TRUE
Description: Use netcat for transferring images instead of RTP stream (default: FALSE)
- name:
VIEWVIDEO_HOST
value: 192.168.1.255
Description: GCS IP (default: MODEM_HOST)
- name:
VIEWVIDEO_PORT_OUT
value: 5000
Description: Port (default: 5000)
- name:
VIEWVIDEO_PORT2_OUT
value: 6000
Description: Port (default: 6000)
- name:
VIEWVIDEO_BROADCAST
value: FALSE|TRUE
Description: Enable broadcast of image stream (default: TRUE)
Define Options
- name:
VIEWVIDEO_CAMERA
value: front_camera|bottom_camera
Description: Video device to use
- name:
VIEWVIDEO_CAMERA2
value: front_camera|bottom_camera
Description: Video device to use
- name:
VIEWVIDEO_DOWNSIZE_FACTOR
value: 4
Description: Reduction factor of the video stream, the image width and height should be divisible by this factor
- name:
VIEWVIDEO_QUALITY_FACTOR
value: 50
Description: JPEG encoding compression factor [0-99]
- name:
VIEWVIDEO_FPS
value: 5
Description: Image frequency for the RTP viewer (recommended >=5Hz)
- name:
VIEWVIDEO_USE_RTP
value: TRUE|FALSE
Description: Enable RTP at startup for transferring images (default: TRUE)
Module functions
Init Functions
These initialization functions are called once on startup.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw video_rtp_stream.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="video_rtp_stream" dir="computer_vision">
<doc>
<description>
Video streaming for Linux based devices.
Works e.g. in conjunction with Parrot Drones where the autopilot is the Paparazzi autopilot.
Sends a RTP/UDP stream of the camera image, a.k.a. live video
</description>
<configure name="VIEWVIDEO_USE_NETCAT" value="FALSE|TRUE" description="Use netcat for transferring images instead of RTP stream (default: FALSE)"/>
<configure name="VIEWVIDEO_HOST" value="192.168.1.255" description="GCS IP (default: MODEM_HOST)"/>
<configure name="VIEWVIDEO_PORT_OUT" value="5000" description="Port (default: 5000)"/>
<configure name="VIEWVIDEO_PORT2_OUT" value="6000" description="Port (default: 6000)"/>
<configure name="VIEWVIDEO_BROADCAST" value="FALSE|TRUE" description="Enable broadcast of image stream (default: TRUE)"/>
<define name="VIEWVIDEO_CAMERA" value="front_camera|bottom_camera" description="Video device to use"/>
<define name="VIEWVIDEO_CAMERA2" value="front_camera|bottom_camera" description="Video device to use"/>
<define name="VIEWVIDEO_DOWNSIZE_FACTOR" value="4" description="Reduction factor of the video stream, the image width and height should be divisible by this factor"/>
<define name="VIEWVIDEO_QUALITY_FACTOR" value="50" description="JPEG encoding compression factor [0-99]"/>
<define name="VIEWVIDEO_FPS" value="5" description="Image frequency for the RTP viewer (recommended >=5Hz)"/>
<define name="VIEWVIDEO_USE_RTP" value="TRUE|FALSE" description="Enable RTP at startup for transferring images (default: TRUE)"/>
</doc>
<settings>
<dl_settings>
<dl_settings name="video">
<dl_setting var="viewvideo.use_rtp" min="0" step="1" max="1" values="FALSE|TRUE" shortname="rtp" module="computer_vision/viewvideo" param="VIEWVIDEO_USE_RTP"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>video_thread</depends>
</dep>
<header>
<file name="viewvideo.h"/>
</header>
<init fun="viewvideo_init()"/>
<makefile target="ap|nps">
<file name="viewvideo.c"/>
<include name="modules/computer_vision"/>
<file name="rtp.c" dir="modules/computer_vision/lib/encoding"/>
<raw>
include $(CFG_SHARED)/udp.makefile
VIEWVIDEO_HOST ?= $(MODEM_HOST)
VIEWVIDEO_PORT_OUT ?= 5000
VIEWVIDEO_PORT2_OUT ?= 6000
VIEWVIDEO_BROADCAST ?= TRUE
VIEWVIDEO_USE_NETCAT ?= FALSE
VIEWVID_CFLAGS = -DVIEWVIDEO_HOST=$(VIEWVIDEO_HOST) -DVIEWVIDEO_PORT_OUT=$(VIEWVIDEO_PORT_OUT) -DVIEWVIDEO_PORT2_OUT=$(VIEWVIDEO_PORT2_OUT)
ifneq (,$(findstring $(VIEWVIDEO_USE_NETCAT),0 FALSE))
ap.CFLAGS += $(VIEWVID_CFLAGS) -DVIEWVIDEO_BROADCAST=$(VIEWVIDEO_BROADCAST)
nps.CFLAGS += $(VIEWVID_CFLAGS) -DVIEWVIDEO_BROADCAST=FALSE
else
$(TARGET).CFLAGS += $(VIEWVID_CFLAGS) -DVIEWVIDEO_USE_NETCAT
endif
</raw>
</makefile>
</module>