🛠 Caméra MIPI CSI et encodage H.264 matériel via GStreamer
Objectives
Leverage the two 4-lane MIPI CSI camera inputs on the AI-64 and the TDA4VM image processing chain (VPAC/CSI2RX capture, VPE/M2M resampling, hardware H.264 encoder) to record 1080p video without loading the Cortex-A72 cores. This is the "smart camera" use case for which the board is designed.
Hardware
- 1 BeagleBone AI-64 with a TI/BeagleBoard image including camera overlays
- 1 compatible CSI camera module (IMX219 class or equivalent, 4-lane FFC ribbon cable)
- Warning: The CSI ribbon cable must be inserted with the copper contacts facing the connector; the board must be POWERED OFF during insertion
Complete Code
sudo apt install v4l-utils gstreamer1.0-tools gstreamer1.0-plugins-bad
v4l2-ctl --list-devices # lister CSI, M2M/VPE et encodeurs
media-ctl -p | grep -E "entity|pad" # cartographier CSI2RX / VPAC / VPE
#!/bin/sh
# record.sh — 5 s de 1080p30 encodées par le SoC (pas par le CPU)
# Les nœuds (/dev/video-rpi-cam0, /dev/video3...) dépendent de l'image et
# des overlays caméra : les confirmer avec media-ctl -p avant de lancer.
gst-launch-1.0 -e \
v4l2src device=/dev/video-rpi-cam0 num-buffers=150 io-mode=5 ! \
"video/x-bayer,format=nv12,width=1920,height=1080,framerate=30/1" ! \
vpe src-io-type=mplane sink-io-type=mplane process-only=1 ! \
v4l2convert ! video/x-raw,format=UYVY ! \
vpe src-io-type=mplane sink-io-type=mplane process-only=1 ! \
v4l2h264enc extra-controls="controls,video_extend=1,compression=1" ! \
h264parse ! mp4mux ! filesink location=out.mp4
Expected Verification
The out.mp4 file containing 150 frames (5 seconds at 30 fps) plays in a video player. During recording, htop shows the Cortex-A72 cores are nearly idle: capture, conversion, and encoding run on the VPAC/VPE/encoder hardware blocks.
Common Errors
- Copying the pipeline without adapting the nodes: v4l2 entities depend on the image and overlays;
media-ctl -pis mandatory to map your own system. - Sensor not linked: Without the sensor's DT overlay, no
/dev/videocapture device appears — checkdmesgfor the sensor's I2C driver probe. - Pure mainline image: The CSI/VPAC/codec chain practically relies on the TI downstream stack; under mainline, you are limited to basic capture.
- Forgetting
io-mode=5(DMABUF): Without coherent mmap-plane negotiation, the pipeline fails or stutters. - Filling the 16 GB eMMC with recordings: Write to a microSD card or external drive.
Other tutorials for this board
- Flasher l'image officielle et démarrer la BeagleBone AI-64
- Faire clignoter une LED sur la broche P8_03 avec libgpiod
- Surveiller la température et l'alimentation du TDA4VM
- Réseau : Ethernet Gigabit unique et module Wi-Fi en M.2 E-key
- Remoteproc : inventorier et démarrer les co-processeurs R5F et C66x
- Inférence de réseau de neurones sur le C7x+MMA avec edgeai-tidl-tools
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash