When I use gstreamer + opencv to record the video （avi） of 2k resolution, the frame rate is about 4-5 fps.
Can I use the hardware codec in gstreamer or opencv directly?
We support tegra_multimedia_api and gstreamer. Please check the documents.
Thank you ！ It is very helpful.And can gstreamer capture the image(csi) then encode the image to h264,meanwhile preview the image.If so,do you know the command to realize this function,or what document I can refer.
The gstreamer documentation will let you do this. You will want to use the hardware h265 encoder, and a tee split operator, to a second display sink.
Various pipelines have been posted in other posts in this forum, so if you need help deciphering the gstreamer reference, and general internet tutorials on the internet plus nvidia specific plugin documentation isn’t enough, try searching for those!
For recording and display you could use the following pipeline as reference. The tricks is using the “tee” element, which splits data to multiple pads.
gst-launch-1.0 videotestsrc is-live=true ! "video/x-raw,width=(int)2048,height=(int)1080,framerate=(fraction)60/1" ! tee name=t t. ! queue ! autovideosink t. ! queue ! x264enc tune=zerolatency ! mp4mux ! filesink location=video.mp4 -e
Now that pipeline above is just a basic example, it should work even in your PC! If you want a similar functionality but using a CSI-2 camera, you could based your use case on this pipeline (asuming that you are capturing using the ISP):
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! nvvidconv ! tee name=t t. ! queue ! autovideosink t. ! queue ! omxh264enc ! qtmux ! filesink location=video.mp4 -e
Or provided that your image sensor outputs YUV already, you could use something similar to this:
gst-launch-1.0 v4l2src ! tee name=t t. ! queue ! autovideosink t. ! queue ! nvvidconv ! omxh264enc ! qtmux ! filesink location=video.mp4 -e
Please note that those pipelines don’t provide functionality to start/stop, or viceversa, the streaming at any time. For more advanced control over the streaming you could use our GStreamer Daemon (gstd) tool, which is basically gst-launch on steroids and it’s open source: https://developer.ridgerun.com/wiki/index.php?title=GStreamer_Daemon_-_Building_GStreamer_Daemon
Hope this info helps you,