Open opencv | Gstreamer warning: cannot query video position :statue=0, value=-1, duration=-1

I am using the OpenCV package to realize video recording function on NVIDIA jetson nano.
When I use the code, I run into the same GStreamer error.

import cv2
import numpy as np

camera = cv2.VideoCapture(“nvarguscamerasrc
! video/x-raw(memory:NVMM),width=640,height=480,format=NV12,framerate=30/1
! nvvidconv flip-method=0 ! videoconvert !video/x-raw,formate=BGR ! appsink”)

fourcc = cv2.VideoWriter_fourcc(*‘mp4v’)

videoOut = cv2.VideoWriter(‘camera.mp4’,fourcc,30.0,(640,480))

isRead,frame = camera.read()
while isRead :
videoOut.write(frame)

  cv2.imshow('xianshi',frame)

  if cv2.waitKey(30) == 27:
       break
  
  isRead,frame = camera.read()

camera.release()
videoOut.release()
cv2.destroyAllWindows()