🛠 Caméra MIPI CSI et encodage H.264 matériel via GStreamer

BeagleBone AI-64 (TI TDA4VM / J721E) · intermediaire · Schéma : IMG-beaglebone-ai64-intermediaire-2-camera-csi-encodage-h264-materiel.svg — BeagleBone AI-64 avec un module caméra relié par nappe FFC au connecteur CSI0, pipeline annoté CSI → VPAC → VPE → encodeur H.264 → fichier MP4.

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials