I’m unsure I correctly understand what you’re trying to achieve, sorry, though if it can help I’d advise for Jetson side:
- Checking what modes your camera provides. Assuming the zed mini is /dev/video0, see what gives:
v4l2-ctl --device=/dev/video0 --list-formats-ext
such as (here using a ZED camera):
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 2560x720
...
Interval: Discrete 0.033s (30.000 fps)
...
So the camera provides concatenated (left and right 1280+1280=2560) 2560x720 video at 30 fps. YUYV
format is referred as YUY2
with gstreamer.
- For encoding, most jetson models (all but Orin Nano) embed a NVENC HW encoder, so instead of nvenc using GPU, there are gstreamer elements such as
nvv4l2h264enc
(and nvv4l2decoder
for NVDEC HW). These elements use video frames from NVMM memory (DMAable buffers). You can use element nvvidconv
for copying from system memory to NVMM memory while converting format with Jetson VIC HW. So you may first try to just encode into h264 video for a few seconds and stop it (Ctrl-C once):
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=2560,height=720,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=30 insert-vui=1 ! queue ! h264parse ! matroskamux ! filesink location=testZed.mkv -e
and check result with (assuming your Jetson has a display and GUI working):
gst-launch-1.0 filesrc location=testZed.mkv ! matroskademux ! h264parse ! nvv4l2decoder ! nv3dsink
You may have to adjust encoding, bitrate, profiles for your needs.
- If ok so far you may try to stream as well. Note that for webrtcbin gstreamer plugin nice might be mandatory (see
gst-inspect-1.0 nice
), in failing case you may have to build a recent version of gstreamer enabling it. Be sure to have libnice
installed (sudo apt search libnice
) before.
Then you may try something like:
gst-launch-1.0 \
v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=2560,height=720,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=30 insert-vui=1 ! tee name=h264video \
h264video. ! queue ! h264parse ! matroskamux ! filesink location=testZed.mkv \
h264video. ! queue ! h264parse ! rtph264pay ! queue leaky=2 ! webrtcbin name=sendonly
Someone more skilled might help for the webrtc/server setup.