GStreamer x264enc faster than nvv4l2h264enc?

In my initial testing of GStreamer RTP streaming pipeline, I find x264enc to be 100 - 200 ms faster in encoding than nvv4l2h264enc.

I’m using OpenCV VideoWriter, here are the pipelines I used for testing:

cv::VideoWriter wrt;
wrt.open("appsrc ! video/x-raw, format=(string)BGR ! videoconvert ! video/x-raw, format=(string)I420 ! nvvidconv ! video/x-raw(memory:NVMM), format=(string)NV12 ! nvv4l2h264enc bitrate=2048000 maxperf-enable=true preset-level=1 ! h264parse ! rtph264pay ! udpsink port=5000 host=127.0.0.1", cv::CAP_GSTREAMER, 0, cap.get(cv::CAP_PROP_FPS), cv::Size(cap.get(cv::CAP_PROP_FRAME_WIDTH), cap.get(cv::CAP_PROP_FRAME_HEIGHT)));
cv::VideoWriter wrt;
wrt.open("appsrc ! video/x-raw, format=(string)BGR ! videoconvert ! video/x-raw, format=(string)NV12 ! x264enc tune=zerolatency speed-preset=superfast bitrate=2048 sliced-threads=true ! h264parse ! rtph264pay ! udpsink port=5000 host=127.0.0.1", cv::CAP_GSTREAMER, 0, cap.get(cv::CAP_PROP_FPS), cv::Size(cap.get(cv::CAP_PROP_FRAME_WIDTH), cap.get(cv::CAP_PROP_FRAME_HEIGHT)));

Am I missing some option in nvv4l2h264enc or what could cause such a big difference in favor of x264enc in the encoding performance?

I’m running JetPack 6.2 on Jetson AGX Orin developer kit.

Hi,
We support jetson_multimedia_api and gstreamer. Please make sure you have checked the document:

There are some examples in

Q: Is there any example of running RTSP streaming?
Q: Is there an example for running UDP streaming?
Q: I have a USB camera. How can I launch it on AGX Orin?

For further issues, please share a method to replicate the issue through gstreamer command, or either sample. We will set up developer kit and check.

Thanks!

Hi,
In single encoding task, it may be possible since CPU capability is capable of handling it. The CPU usage may be higher when comparing to hardware encoder, and power consumption may be more. Your pipeline looks optimal in running a gstreamer pipeline in OpenCV. If reducing 100 - 200 ms latency is more important in the use-case, please use software encoder.

Thanks for the responses! I might go with software encoder for now and check again later if hardware acceleration brings advantage when the pipeline gets more complex.