Birds Eye View - GStreamer - Jetson Pipelines

From RidgeRun Developer Wiki



⇦ GStreamer/Generic Pipelines Home Performance Measurements/NVIDIA Jetson ⇨




For testing the plugin you can also use the following examples for x86 for different situations. These pipelines are just a guide, you can combine and modify them to fit your needs.

Setting up Environment Variables

First, is important to create the calibration file using the calibration tool. For the following examples, we will use the Birds Eye View calibration file provided. Therefore, the examples will expect the input of 6 cameras and a resolution of 1280x720px, the number of cameras and resolution can be adjusted depending on the calibration file.

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 a image

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


The expected output would be the following.

Birds Eye View result

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 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_0 \
udpsrc port=4001 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_1 \
udpsrc port=4002 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_2 \
udpsrc port=4003 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_3 \
udpsrc port=4004 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_4 \
udpsrc port=4005 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_5 \
bev name=bev calibration-file=$CALIBRATION_FILE ! queue ! nvvidconv ! nvv4l2h264enc bitrate=20000000  ! h264parse ! mp4mux ! filesink location=$OUTPUT

Streaming via UDP+RTP

Set the HOST variable to the Receiver's IP

Sender

gst-launch-1.0 -v \
udpsrc port=4000 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_0 \
udpsrc port=4001 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_1 \
udpsrc port=4002 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_2 \
udpsrc port=4003 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_3 \
udpsrc port=4004 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_4 \
udpsrc port=4005 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! queue ! bev.sink_5 \
bev name=bev calibration-file=$CALIBRATION_FILE ! queue ! nvvidconv ! nvv4l2h264enc bitrate=20000000 ! 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

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 ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_0 \
 filesrc location=$INPUT_1 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_1 \
 filesrc location=$INPUT_2 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_2 \
 filesrc location=$INPUT_3 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_3 \
 filesrc location=$INPUT_4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_4 \
 filesrc location=$INPUT_5 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! $CAPS ! bev0.sink_5 \
 bev0. !  queue ! nvvidconv ! xvimagesink

Birds Eye View from 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 \
 nvarguscamerasrc sensor-id=0 ! nvvidconv ! $CAPS ! bev0.sink_0 \
 nvarguscamerasrc sensor-id=1 ! nvvidconv ! $CAPS ! bev0.sink_1 \
 nvarguscamerasrc sensor-id=2 ! nvvidconv ! $CAPS ! bev0.sink_2 \
 nvarguscamerasrc sensor-id=3 ! nvvidconv ! $CAPS ! bev0.sink_3 \
 nvarguscamerasrc sensor-id=4 ! nvvidconv ! $CAPS ! bev0.sink_4 \
 nvarguscamerasrc sensor-id=5 ! nvvidconv ! $CAPS ! bev0.sink_5 \
 bev0. !  queue ! fakesink silent=false -v



⇦ GStreamer/Generic Pipelines Home Performance Measurements/NVIDIA Jetson ⇨