Veethree D7 SDK
Loading...
Searching...
No Matches
Video inputs on the D7 Platform

< Details index

Available inputs

The D7 supports four SDTV NTSC or PAL cameras via CVBS. The inputs for them are available via the AMPSEAL 23-pin interface via the 4 pairs of pins labeled CVBS IN#+/-.

The cameras need to be powered externally.

Only one input can be selected and streamed at a time.

All the commands in this section should be run on the target device.

CVBS camera inputs on AMPSEAL 23-pin connector

Testing the camera input using v4l2 utilities

Both the release and development images for the D7 come preinstalled with a number of the v4l2 utilities; specifically:

  • v4l2-ctl
  • v4l2-dbg
  • v4l2-sysfs-path
  • v4l2-compliance
  • media-ctl

On the target device the video decoder device is /dev/v4l-subdev1, but all the controls it has are exposed via /dev/video2 as well.

This way all the controls – setting or getting the video standard, setting the currently active input and image processing options – are available using the v4l2 ioctls on just one video device, /dev/video2.

Getting and setting the active input

Only one of the four inputs can be active at any moment.

The following commands give examples for getting all the available inputs, getting the currently active input and setting the active input.

# Get all available inputs
v4l2-ctl --device /dev/video2 --list-inputs
# Get currently active input
cat /sys/devices/platform/bus\@5a000000/5a810000.i2c/i2c-1/1-0021/cvbs/current_input
# Set input 1 as the currently active input
echo 1 > /sys/devices/platform/bus\@5a000000/5a810000.i2c/i2c-1/1-0021/cvbs/input

Video standards

All video inputs support the same set of video standards. The supported standards can be queried using:

v4l2-ctl --device /dev/video2 --list-standards

Notes:

  • Only PAL and NTSC are supported at the moment
  • The video standard is the same for all inputs
  • Switching inputs does not change the currently set standard
  • The D7 defaults to NTSC on startup

Getting and setting the standard can be done by running:

# Getting the standard
v4l2-ctl --device /dev/video2 --get-standard
# Setting the standard
v4l2-ctl --device /dev/video2 --set-standard PAL

Image processing options

To see all the available options, connect to the D7 and run:

v4l2-ctl --device /dev/video2 --list-ctrls

This command also lists the value ranges, defaults and current values for each controls.

Getting the value of a specific control

For the following example we will get and set the value for brightness.

The commands for the other controls are similar.

Note: For boolean controls, such as horizontal_flip, 0 is false and 1 is true.

v4l2-ctl --device /dev/video2 --get-ctrl brightness

Setting the value of a specific control

v4l2-ctl --device /dev/video2 --set-ctrl brightness=10

Displaying the input from a camera using GStreamer

To test the input from a camera, you can display it using GStreamer.

Note: GStreamer will check the resolution and framerate in the pipeline's filtercaps against the current standard set for the v4l2 device. If they don't match, the pipeline will fail to start.

  • For NTSC, that is 720x480 at 29.97fps (width=720,height=480,framerate=30000/1001)
  • For PAL, that is 720x576 at 25fps (width=720,height=576,framerate=25/1)
Remarks
If there is any application currently using the display – like the default application the displays the board's serial number and IP address – it will need to be stopped before starting the GStreamer process.

If the default application is running, to stop it run systemctl stop qml-hello-world-app.service.

Steps:

  1. Select the color format:
    # Example for selecting NTSC
    v4l2-ctl --device /dev/video2 --set-standard NTSC
  2. Select one of the available inputs (0-3)
    # This selects input 0
    v4l2-ctl --device /dev/video2 --set-input 0
  3. Display the input from the input using GStreamer
    gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,width=720,height=480,framerate=30000/1001 ! autovideosink

Examples

Notes for building applications using QT and GStreamer

The Qt Multimedia framework has a GStreamer backend. More in depth documentation about it can be found at https://doc.qt.io/qt-6.8/qtmultimedia-gstreamer.html.

When using GStreamer pipelines as part of Qt applications it is recommended to display the output using GStreamer's qml6glsink.

It is also recommended to avoid setting QMediaPlayer's source field to gstreamer-pipeline: ... and the QGStreamerPlatformSpecificInterface to create a custom GStreamer camera, as both of these solutions are known to produce segmentation faults at random points during execution.

The GStreamer libraries are currently not part of the Host SDK on either Linux or Windows. That means that in order to build applications that use GStreamer and run on the host, the GStreamer libraries will need to be available at the system level.

This is similar to how Qt libraries are used for building host applications. See Host build for more details on building host applications with Qt.