Nvarguscamerasrc with OpenCV delay


I am working on display real-time videos with GStreamer in OpenCV. I tried the examples in opencv_gst_samples_src. The pipeline is like:
pipeline_str << “nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)”
<< std::to_string(width) << “, height=(int)” << std::to_string(height)
<< “, format=(string)NV12, framerate=(fraction)” << std::to_string(fps)
<< “/1 ! nvvidconv ! video/x-raw, format=(string)I420 ! videoconvert”
" ! video/x-raw, format=(string)BGR ! appsink";
It works well when using default settings: width=1280, height=720, fps=30.
However, there is obvious delay when I use higher resolution or higher framerate.
Is there any solution that can improve the performance?
Thanks in advance!