Parallel Encoding Pipeline with Single Camera using Gstreamer

Hi Folks,

New to Nvidia Dev Community. Bare if its already asked before. I tried lots of researching on this. But couldn’t find solution. so here is my query details.

Based on my application,

I want to perform parallel encoding with gstreamer with Single Camera. I see that, Jetson Nano has capabilities of 4x1080p encoding in Parallel with different encoding parameters. For example,

  • 1x1080p, For Streaming over Network

  • 1x1080p, Record inside File with any Muxer

  • 1 Raw Buffer (Not Encoded) Pipeline to AI/ML or Computer Vision Algorithm

What I tried till now is,

  • Try to use shmsink and shmsrc but it didn’t went as per expectation. For Example, putting raw data buffer inside shmsink socket-path=/tmp/foo. Use it with shmsrc socket-path=/tmp/foo in one 1080p for video streaming over Network. Use another shmsrc socket-path=/tmp/foo in another 1080p for record inside storage.

Note: I have already read the Nvidia Gstreamer Acceleration Guide. But couldn’t find the information.

Any suggestion or help is appreciated.


You have to use plugin tee:

gst-launch-1.0 -e nvarguscamerasrc num-buffers=300 ! 'video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=30/1' ! tee name=video ! queue ! nvv4l2h265enc insert-vui=1 ! h265parse ! tee name=h265encoded ! queue ! rtph265pay config-interval=1 ! udpsink host= port=5000    h265encoded. ! queue ! matroskamux ! filesink location=test_h265.mkv    video. ! queue ! nvvidconv ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! filesink location=video.raw.NV12

I’ve limited to 300 frames because the raw format can fill your filesystem very quickly. 300 frames result in almost 1GB. Be sure you have enough space before trying. Do not save on rootfs unless you are sure there is enough room, it may break your system.

When running, the UDP stream should be available on localhost port 5000, so you can display with:

gst-launch-1.0 udpsrc port=5000 ! queue ! application/x-rtp, media=video, encoding-name=H265 ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink

When done, you can read h265-encoded video in mkv container with:

gst-launch-1.0 filesrc location=test_h265.mkv ! matroskademux ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink

and read raw (NV12) video with:

gst-launch-1.0 filesrc location=video.raw.NV12 ! videoparse format=nv12 width=1920 height=1080 framerate=30/1 ! videoconvert ! xvimagesink