Hi,
Please refer to this sample and try:
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL
However it is uncertain if we can achieve 4Kp30 since BGR is not supported by hardware blocks so there are multiple buffer copy/conversion. These impact the performance. There is discussion in
[Gstreamer] nvvidconv, BGR as INPUT - #2 by DaneLLL
For optimal solution, we would suggest use gstreamer or jetson_multimedia_api. We also have VPI supporting some image filters:
VPI - Vision Programming Interface: Installation