Jetson nano python program freezes on the line cv2.VideoWriter.write(frame)

Hi,
Looks like you use omxh264enc plugin in the pipeline. We have deprecated omx plugins. Please try v4l2 plugins.

You can refer to this python sample:
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL