H.264 encoding problem issue

Hi everyone, I want to Record a live video in h.264 encode format.When i am executing the command
gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM), width=3264, height=2464,format=NV12, framerate=21/1’ ! omxh264enc ! qtmux ! filesink location=V3.mp4 -e on the terminal everything works fine.So i want to do in programmatic way .I wrote in python and i am getting error as mentioned in the screenshot.
Any suggestion is helpful to me.Thanks in advance.
Program Code:
import cv2
dispW = 640 #muliples of 320
dispH = 480 #muliples of 240
flip = 2

camSet =‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464,format=NV12, framerate=21/1 ! omxh264enc ! qtmux ! filesink’
PiCam = cv2.VideoCapture(camSet)
fourcc = cv2.VideoWriter_fourcc(*‘H264’)
outVideo = cv2.VideoWriter(‘/tmp/myCam4.mp4’,fourcc,21,(dispW,dispH))

while True:
ret,frame = PiCam.read()
cv2.imshow(‘PiWindow’,frame)
cv2.moveWindow(‘PiWindow’,0,0)
outVideo.write(frame)
if cv2.waitKey(1) == ord(‘q’): #wait for 1msec and key press is q then it break
break
PiCam.release()
outVideo.release()
cv2.destroyWindow(‘PiWindow’)

Screenshot: