Can not open CSI-camera with gstreamer pipeline on Jetson Nano

Hi,

I try to open IMX 477 CSI-Camera with this code from (MIPI_Camera/Autofocus.py at master · ArduCAM/MIPI_Camera · GitHub):

def gstreamer_pipeline (capture_width=1280, capture_height=720, display_width=640, display_height=360, framerate=60, flip_method=0) :
return ('nvarguscamerasrc ! ’
'video/x-raw(memory:NVMM), ’
'width=(int)%d, height=(int)%d, ’
'format=(string)NV12, framerate=(fraction)%d/1 ! ’
'nvvidconv flip-method=%d ! ’
'video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! ’
'videoconvert ! ’
‘video/x-raw, format=(string)BGR ! appsink’ % (capture_width,capture_height,framerate,flip_method,display_width,display_height))

But It shows in terminal:
“cv2.erro:OpenCV(4.5.5) /io/opencv/modules/highgui/src/window.cpp:1000:error:(-215 Assertion failed) size.width>0 && size.height>0 in function ‘imshow’”.

THEN I used the second pipeline code in terminal, these is not problem to open camera:

gst-launch-1.0 nvarguscamerasrc sensor_id=0 !
‘video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1’ !
nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=540’ !
nvvidconv ! nvegltransform ! nveglglessink -e

Anyone know what is the probem from the first gstreamer_pipeline code?
Because I need add the gstreamer_pipeline code in scripts not just use it in terminal.

Thanks.

It could be the output size didn’t define.

What ist output size?
In first code the capture_size and display_size are defined.

I don’t know. You need to check your source code to know the detail.