< Details index
Available inputs
The D7 contains the ADV7280A Analog Video Decoder. Four analog video input channels are available via the AMPSEAL 23-pin (CVBS IN#+/- pins). SDTV NTSC/PAL/SECAM is supported via CVBS. The cameras need to be powered externally. Only one input can be selected and streamed at a time.
CVBS camera inputs on AMPSEAL 23-pin connector
On the target device the video decoder device is /dev/camera-sensor0, but all the controls it has are exposed via /dev/camera0 as well.
Note: The paths /dev/camera0 and /dev/camera-sensor0 are symlinks. Since the raw device nodes are subject to change between SDK versions, users must rely on the stable symlinks when using camera inputs.
GStreamer is used to test the input from the camera along with v4l2 utilities to control inputs on /dev/camera0.
Monitoring using GStreamer
Displaying Input from an NTSC camera
For an NTSC camera, the framerate is 720x480 at 29.97fps
To display video feed from camera connected on input 0, set the colour format to NTSC and start GStreamer:
v4l2-ctl --device /dev/camera0 --set-standard NTSC
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=480,framerate=30000/1001 ! autovideoconvert ! autovideosink
Displaying Input from a PAL camera
Similarly for PAL camera connected on input 0, set the colour format and start GStreamer. The framerare to be used is 720x576 at 25fps
v4l2-ctl --device /dev/camera0 --set-standard PAL
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=576,framerate=25/1 ! autovideoconvert ! autovideosink
Test a camera connected to a different input
Only one of the four inputs can be active at any moment so the active input needs to be set to the input that the camera is connected to:
# Set input 1 as the currently active input
v4l2-ctl -d /dev/camera0 --set-ctrl input=1
then run start the pipeline by setting camera standard and run the GStreamer command:
# Start the pipeline
v4l2-ctl --device /dev/camera0 --set-standard NTSC
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=480,framerate=30000/1001 ! autovideoconvert ! autovideosink
Advanced Usage
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
Some common examples are:
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/camera0 --get-ctrl brightness
Setting the value of a specific control
Similar to getting the value of a control, setting its value follows:
v4l2-ctl --device /dev/camera0 --set-ctrl brightness=10
List all available inputs
To get a list of all available inputs run:
v4l2-ctl --device /dev/camera0 --list-ctrls
Look for the field that says input.
To get the currently active input:
# Get currently active input
v4l2-ctl -d /dev/camera-sensor0 --get-ctrl input
List all video standards
All video inputs support the same set of video standards. The supported standards can be queried using:
v4l2-ctl --device /dev/camera0 --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/camera0 --get-standard
# Setting the standard
v4l2-ctl --device /dev/camera0 --set-standard PAL
List all available controls
To see all the available options, connect to the D7 and run:
v4l2-ctl --device /dev/camera0 --list-ctrls
This command also lists the value ranges, defaults and current values for each controls.
Other ways to set active input
The currently active input can be read and set in 2 ways- Using sysfs:
# Set input 1 as the currently active input
echo 1 > /sys/devices/platform/bus\@5a000000/5a810000.i2c/i2c-1/1-0021/cvbs/input
# Get currently active input
cat /sys/devices/platform/bus\@5a000000/5a810000.i2c/i2c-1/1-0021/cvbs/current_input
# OR
cat /sys/devices/platform/bus\@5a000000/5a810000.i2c/i2c-1/1-0021/cvbs/input
Or using the equivalent ioctls:
# Set input 1 as the currently active input
v4l2-ctl -d /dev/camera0 --set-ctrl input=1
# Get currently active input
v4l2-ctl -d /dev/camera-sensor0 --get-ctrl input # will output '1'
GStreamer output video format
The pipeline outputs video stream in YUV format by default. To display camera input in this format run:
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=480,framerate=30000/1001 ! autovideoconvert ! autovideosink
# OR
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=480,framerate=30000/1001,format=NV12 ! autovideosink
Alternatively, you can set the output format of the ISI to RGB
media-ctl -d /dev/media1 -V '"mxc_isi.0":1 [fmt:RGB888_1X24/720x480 field:none colorspace:srgb]'
gst-launch-1.0 v4l2src device=/dev/camera0 ! video/x-raw,width=720,height=480,framerate=30000/1001 ! autovideosink
Examples
Video Examples includes code examples relating to video