most efficient rtmp stream with gstreamer + csi-camera

Hi,

im using a jetson nano and a 8 megapixels Waveshare IMX219-120 camera for a livestreaming project. At the moment i run this command on the nano:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=1848, framerate=28/1, format=NV12' ! nvvidconv flip-method=0 ! videocrop top=620 left=150 right=120 bottom=680  ! x264enc ! flvmux ! rtmpsink location='rtmp://x.x.x.x:1935/live/test '

Is there a better/efficient way in my pipeline? How can I resize the frames to make the stream faster? My goal is to reach 28fps on the (cloud) server. Should I write an application in c++ and use opencv?

fun fact:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=28/1, format=NV12' !

In fullhd the frames are extreme “zoomed”, so unfortunately i can’t use this option

best regards Martin

Hi Martin,

I suggest replacing x264enc for a hardware accelerated encoder like nvv4l2h264enc or omxh264enc (deprecated since release 32.1), also you can downscale/crop the video using nvvidconv which may effectively avoid using videocrop.

For more information you can take a look of the NVIDIA accelerated GStreamer plugins documentation here: https://developer.download.nvidia.com/embedded/L4T/r32_Release_v1.0/Docs/Accelerated_GStreamer_User_Guide.pdf?tXA3VtM5kR80PqcoxsAkqikc-1rr0conKHz7lq0H1wM_U3RzyZuX1lBJShakUjbiyAXTUTiMCsGdn6L8JFxGgKxButMZP6nRORHSpE7hbTy1klLIUstO64WblF3i3n-iLu1FGRep1pmUQAFSFCVNov-ZViBlJv30Xco0lSguKLp4x8pEiWQ

Regards,

Hi Jafet, very nice! This works awesome! Only 50% cpu usage

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=1848, framerate=28/1, format=NV12'  !  nvv4l2h264enc ! h264parse ! flvmux ! rtmpsink location='rtmp://x.x.x.x:1935/live/test '

But how/where can i crop the image with

! nvvidconv left=400 right=1520 top=200 bottom=880 !
(gst-launch-1.0:7879): GStreamer-CRITICAL **: 19:47:19.446: gst_mini_object_unref: assertion 'GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0' failed

can’t link them together

best regards Martin

Okay this is stupid!

Found the solution for “cropping” here:
https://devtalk.nvidia.com/default/topic/1051067/gstreamer-1-0-video-crop/

now im using:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=1848, framerate=28/1, format=NV12'  ! nvvidconv left=200 right=3080 top=600 bottom=1200 !  'video/x-raw,width=2880, height=600, framerate=28/1, format=NV12, pixel-aspect-ratio=1/1' ! nvvidconv ! nvv4l2h264enc ! h264parse ! flvmux ! rtmpsink location='rtmp://x.x.x.x:1935/live/test '

best regards Martin