Birds Eye View - GStreamer - i.MX8 Pipelines

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page




⇦ GStreamer/Jetson Pipelines Home Performance ⇨




This page describes reference GStreamer pipelines for running the Birds Eye View plugin on NXP i.MX8 platforms with hardware acceleration enabled. The pipelines illustrate common usage scenarios and show how BEV integrates with i.MX8 hardware blocks (ISP, GPU, and VPU where applicable) for efficient, low-latency processing.

The examples are intended as starting points. They can be adapted, extended, or combined depending on camera topology, resolution, and performance requirements.

Setting up Environment Variables

Before running any pipeline, generate a calibration file using the BEV calibration tool. The examples below assume the provided reference calibration file is used, which is configured for 6 camera inputs at 1280×720 resolution. Both the number of cameras and the resolution must match the calibration file and can be adjusted accordingly.

CALIBRATION_FILE=birds_eye_view.json
CAPS="video/x-raw,format=RGBA"

You'll note that we deliberately avoid setting the image resolution in the caps, since the image codecs should automatically parse the correct values.

Birds Eye View from images

For this example, we will use the sample images provided.

Saving an Image

The following pipeline takes six JPEG input images and composes them into a single Birds Eye View JPEG output.

gst-launch-1.0   bev name=bev0 calibration-file="$CALIBRATION_FILE" \  
    filesrc location=samples/bev_6_cameras/cam_0.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_0 \    
    filesrc location=samples/bev_6_cameras/cam_1.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_1 \  
    filesrc location=samples/bev_6_cameras/cam_2.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_2 \ 
    filesrc location=samples/bev_6_cameras/cam_5.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_3 \  
    filesrc location=samples/bev_6_cameras/cam_4.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_4 \ 
    filesrc location=samples/bev_6_cameras/cam_3.jpg ! jpegdec ! videoconvert ! $CAPS ! queue ! bev0.sink_5 \  
    bev0. ! queue ! videoconvert ! video/x-raw,format=I420 ! jpegenc ! filesink location="$OUTPUT"

The expected output is shown below.

Birds Eye view from UDP SRC

For this example, the ports for each camera will start from 4000 to 4005.

Saving a mp4 file

gst-launch-1.0 -ve \  
udpsrc port=4000 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_0 \  
udpsrc port=4001 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_1 \  
udpsrc port=4002 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_2 \  
udpsrc port=4003 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_3 \  
udpsrc port=4004 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_4 \  
udpsrc port=4005 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_5 \  
bev name=bev calibration-file="$CALIBRATION_FILE" ! queue ! imxvideoconvert_g2d ! $CAPS ! videoconvert ! video/x-raw,format=NV12 ! v4l2h264enc ! h264parse ! mp4mux ! filesink location="$OUTPUT"

Streaming output via UDP+RTP

Set the HOST variable to the Receiver's IP

Sender

gst-launch-1.0 -ve \
udpsrc port=4000 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_0 \
udpsrc port=4001 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_1 \
udpsrc port=4002 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_2 \
udpsrc port=4003 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_3 \
udpsrc port=4004 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_4 \
udpsrc port=4005 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev.sink_5 \
bev name=bev calibration-file="$CALIBRATION_FILE" ! queue ! imxvideoconvert_g2d ! $CAPS ! videoconvert ! video/x-raw,format=NV12 ! v4l2h264enc ! h264parse ! rtph264pay config-interval=10 ! queue ! udpsink host="$HOST" port="$PORT"

Receiver

gst-launch-1.0 udpsrc port=$PORT ! 'application/x-rtp,media=video,encoding-name=H264' !  queue ! rtph264depay ! avdec_h264 ! videoconvert ! xvimagesink

Birds Eye view from mp4 files

Define the name of each MP4 file in the INPUT_# variables.

Displaying

gst-launch-1.0 bev name=bev0 calibration-file="$CALIBRATION_FILE" \  
    filesrc location="$INPUT_0" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_0 \ 
    filesrc location="$INPUT_1" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_1 \ 
    filesrc location="$INPUT_2" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_2 \  
    filesrc location="$INPUT_3" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_3 \  
    filesrc location="$INPUT_4" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_4 \  
    filesrc location="$INPUT_5" ! qtdemux ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! $CAPS ! queue ! bev0.sink_5 \
    bev0. ! queue ! imxvideoconvert_g2d ! $CAPS ! videoconvert ! waylandsink sync=false

Birds Eye View from V4L2 cameras

First, define the device ID for each camera. For this example, each camera will follow the common id provided by USB cameras.

Dumping output to Fakesink

This option is commonly used for debugging.

gst-launch-1.0 bev name=bev0 calibration-file="$CALIBRATION_FILE" \
 v4l2src device=/dev/video0 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_0 \
 v4l2src device=/dev/video1 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_1 \
 v4l2src device=/dev/video2 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_2 \
 v4l2src device=/dev/video3 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_3 \
 v4l2src device=/dev/video4 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_4 \
 v4l2src device=/dev/video5 ! imxvideoconvert_g2d ! $CAPS ! bev0.sink_5 \
 bev0. !  queue ! fakesink silent=false -v



⇦ GStreamer/Jetson Pipelines Home Performance ⇨