Camera capture on Xavier

I have successfully used the gstreamer command to cast the camera frame to the screen:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)1928, height=(int)1208, framerate=30/1' ! nvvidconv flip-method=0 ! 'video/x-raw, format=(string)I420' ! xvimagesink -e

How can I use opencv to capture camera?
I use below code but got fail:

import cv2
cap = cv2.VideoCapture("nvarguscamerasrc sensor-id=0 !\
        width=(int)1928, height=(int)1208,format=(string)I420,\
        framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw,\
        format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR !\
if cap.isOpened():
    print ("Success to open camera.")
    print ("Fail to open camera.")

Error Message:

"" 15L, 444C written
y idia@xavier:~/NCTU_XAVIER/mix_behavior/C3D-tensorflow$ python
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1928 x 1208 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 48.000000; Exposure Range min 110000, max 166577000;

GST_ARGUS: Running with following settings:
   Camera index = 0
   Camera mode  = 0
   Output Stream W = 1928 H = 1208
   seconds to Run    = 0
   Frame Rate = 29.999999
GST_ARGUS: PowerService: requested_clock_Hz=27216000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp, line 887
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:

/home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp:887: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

Fail to open camera.

You should set format=NV12 to nvarguscamerasrc

For your reference, please check

Hi DaneLLL,

You solved my problem, thanks.