Gstreamer: Losing frames while displaying from the camera

i’m wondering if someone could help me, i’m trying to display and save videos from my flir hadron camera ,i’m using gstreamer in python3 opencv and it succefully displays and saves the IR videos from the BOSON, but i’m losing frames in the RGB videos which leads to slow displaying and fast playback and tried to add various command to the gstreamer piplines such as videorate to control the fps but nothing help .

i cheked while executing the code that it’s using just the CPU part of the jetson nano , so i’ve installed CUDA to be able to use the GPU and i don’t know what i’ve have to add in my code to force it to use the GPU of the computer

i’de appreciate any help thank you

here is the RGB code for displaying and saving:

import cv2

camset=‘v4l2src io-mode=4 device=/dev/video0 do-timestamp=true ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! queue ! videoconvert ! videorate ! video/x-raw,format=BGR ! appsink drop=1’

if cap.isOpened() is not True:
print(“Cannot open camera. Exiting.”)
actual_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
actual_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
actual_fps = float(cap.get(cv2.CAP_PROP_FPS));
print(‘Capture opened framing %d x %d @ %f’ % (actual_width,actual_height,actual_fps))

gst_writer_str = ‘appsrc ! video/x-raw,format=BGR,width=1920,height=1080,framerate=30/1 ! queue ! videoconvert ! video/x-raw,format=BGRx ! nvvidconv ! nvv4l2h265enc maxperf-enable=1 preset-level=4 control-rate=1 bitrate=14000000 ! h265parse ! qtmux ! filesink location=streaming.mp4’
fourcc = 0 #RAW
out = cv2.VideoWriter(gst_writer_str, cv2.CAP_GSTREAMER, fourcc, actual_fps, (actual_width, actual_height), True)
if not out.isOpened():
print(“Cannot open writer. Exiting.”)

while (True):
ret,frame =
if cv2.waitKey(1) & 0XFF == ord(‘q’):

what do you suppose that videorate and drop=1 do?