OpenCV Video Capture with GStreamer doesn’t work but work on terminal

Hi,
Please refer to this sample:
OpenCV Video Capture with GStreamer doesn't work on ROS-melodic - #3 by DaneLLL

For putting gstreamer pipeline in cv2.VideoCapture(), please begin with nvarguscamerasrc and end with appsink.