Skip to main content

Camera & video

This is the application-development reference for camera acquisition and video processing, independent of a neural network. The worked pipeline takes Bayer frames through the TI ISP and saves 1920 × 1080 JPEG files without taking over HDMI. Use it to validate an application's input before adding inference, encoding or network transport.

For first-time hardware preparation, follow Connect the IMX219 camera and Initialize and check the camera. Those are the single setup instructions; this page starts with the connected, initialized camera. Stop any running preview or NPU demo before accessing the capture device. Disconnect power before changing the ribbon.

Tested path

This procedure was tested on a V1.1.0 development installation with Linux 6.12.35. The current stack inventory reports GStreamer 1.26.2 and TI plugins 0.7.0; see the measured version map, including development-patch boundaries. The V4L2 mmap capture path (io-mode=2) completed repeatedly with normal end-of-stream and two valid JPEG files. This is a frame-capture test, not a sustained frame-rate benchmark or a certification of every camera or codec.

Inspect capture interfaces and formats​

Use the camera-enabled microSD-default boot entry for this pipeline. Peripheral-test entries do not all include the camera overlay; see Device tree overlays for selecting an entry. Inspect configuration before changing it; a capture test does not require an otherwise unnecessary reboot.

An application needs the capture node, sensor-control node and media-controller topology. The setup procedure creates aliases and records the discovered configuration in /etc/csi-camera/csi-camera.conf. On the tested board the capture alias resolves to /dev/video2; numeric nodes can change, so use the alias in application configuration.

NodePurpose
/dev/video-imx219-cam0CSI image capture
/dev/v4l-imx219-subdev0IMX219 sensor controls
/dev/media0Media-controller topology on the tested image

Inspect the actual devices and required plugins:

sudo v4l2-ctl --list-devices
sudo media-ctl -d /dev/media0 --print-topology
sudo gst-inspect-1.0 tiovxisp
sudo gst-inspect-1.0 jpegenc

The CSI node supplies Bayer data, not a ready-to-display RGB image. The pipeline must apply the sensor's ISP tuning before converting or encoding it. Codec devices and CSI devices can appear together in v4l2-ctl; do not choose a codec node as the camera source.

Live Mo62A V4L2 device and GStreamer codec-plugin discovery; enumeration does not demonstrate successful encoding
note

The codec discovery screenshot comes from a development test system with earlier codec work. It shows what that system enumerated, not a stock-image support matrix. Finding an encoder plugin does not prove that encoding, format negotiation or a complete streaming application works.

Capture JPEG frames​

Download capture-jpeg-mmap.sh and copy it to the board. Choose an output directory that does not already exist:

sudo bash capture-jpeg-mmap.sh /tmp/camera-capture-01

The script initializes the camera, processes 30 frames and retains the final two files. It refuses to reuse an existing output directory. The core pipeline is:

gst-launch-1.0 \
v4l2src device=/dev/video-imx219-cam0 io-mode=2 num-buffers=30 ! \
'video/x-bayer,format=rggb,width=1920,height=1080,framerate=30/1' ! \
tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI \
dcc-isp-file=/opt/imaging/imx219/linear/dcc_viss.bin \
sink_0::dcc-2a-file=/opt/imaging/imx219/linear/dcc_2a.bin \
format-msb=7 ! \
'video/x-raw,format=NV12,width=1920,height=1080' ! \
videoconvert ! jpegenc quality=90 ! \
multifilesink location=/tmp/camera-capture-01/frame-%02d.jpg max-files=2

For direct use, complete the linked camera initialization, create a fresh output directory, and run GStreamer with root permissions as the downloaded script does. The helper repeats initialization internally so each capture uses the intended sensor configuration; it does not launch an AI demo.

StageWork performed
v4l2srcAcquire 1920 × 1080 RGGB Bayer frames using mmap
tiovxispApply the IMX219 DCC files through the TI ISP and output NV12
videoconvertConvert to a pixel format accepted by the JPEG encoder
jpegencEncode JPEG on the CPU; this is not the E5010 hardware encoder
multifilesinkWrite numbered files and keep the newest two

Expect Got EOS, pipeline cleanup and file output identifying frame-28.jpg and frame-29.jpg as 1920 × 1080 JPEG images. The capture shown below includes pipeline setup and processing; its duration is not a pure ISP or encoding benchmark.

Repeated mmap-based IMX219 capture completing with EOS and two valid 1920 by 1080 JPEG files

Open the files on the desktop, or copy them to your computer using your own SSH account and hostname. Check framing, focus and exposure as well as file validity. /tmp is temporary storage; copy any images you need to retain elsewhere. Review images for private information before sharing them.

To repeat the test, use a new directory such as /tmp/camera-capture-02. Stop one capture before starting another.

Buffer modes and display ownership​

The example deliberately selects V4L2 mmap (io-mode=2). Do not change it to DMA-buffer import merely because another example uses that mode: the producer, ISP and downstream elements must agree on buffer allocation and layout. An earlier JPEG experiment using io-mode=5 stalled on repeated starts; the mmap procedure above completed repeatedly. That observation does not establish a driver root cause or mean every DMA-buffer pipeline fails.

The saved-file pipeline leaves the desktop available. Replacing the file sink with kmssink introduces display ownership and permission requirements; it is not just a change of output filename. The installed imx219-preview.sh helper uses that separate path and stops LightDM, but HDMI preview was not revalidated for this page. Use the verified JPEG output to isolate capture problems and Display & audio for display configuration.

Video codecs and streaming​

Camera acquisition, ISP processing, encoding, decoding and network transport are separate stages. This page verifies the first three stages only for software JPEG encoding.

TaskEvidence and boundary
Camera-to-JPEGRepeated mmap acquisition, TI ISP processing and CPU JPEG encoding verified here
Video-file inferenceSee the tested scenarios in Run your first NPU demo; file decoding is a separate path
H.264 / H.265 encodingPlugins were enumerated in the development environment; end-to-end encoding was not tested here
RTSP publishingNo validated RTSP server recipe is supplied on this page
USB cameras or another CSI sensorNot tested by this IMX219 procedure; sensor format, driver and ISP tuning must be checked separately

Do not replace jpegenc with a hardware codec element and assume the pipeline remains valid. Check accepted formats, buffer modes, resolution and actual output before adding transport or inference.

Troubleshooting​

SymptomWhat to check
Capture alias is missingComplete the linked camera initialization, confirm a camera-enabled boot entry, and inspect the media topology.
Camera is busyStop the application that owns it. sudo fuser /dev/video-imx219-cam0 identifies users; do not kill unrelated video applications.
Permission denied or missing plugins as a normal userRun the supplied procedure with sudo. Compare root plugin discovery before concluding that a plugin is absent.
Missing DCC filesCheck both files under /opt/imaging/imx219/linear/ and initialize the camera. Do not use tuning files for another sensor.
Pipeline stays at PLAYING without filesCheck device ownership and use the tested io-mode=2 path. Stop the stalled process before retrying; preserve its log if the problem repeats.
Files are valid but darkCheck lighting and sensor exposure/gain controls; file validity alone does not establish image quality.
Desktop is absent after previewExit the preview first, then check systemctl status lightdm. Restart it only after the preview has released the display.

Source: inhandnet/mo-docs · 7ba0dc46