Hi all,
I have a problem with the H.264 RTSP stream decoder in a Jetson nano, I will be very glad to guide me.
I want to use a multi-stream rtsp 1080 using hardware decoder of a Jetson nano using gstreamer + opencv + python.
My jetson nano has:
jetpack 4.2.2 + opencv 3.4.6( installed from source)
When I used the code below, My cpu usage became high, but the decoded frames were corrected.
gstream_elemets = (
'rtspsrc location={} latency=300 !'
'rtph264depay ! h264parse !'
'queue max-size-buffers=100, leaky=2 !' ## leaky=2 (drop old buffers)
'omxh264dec enable-max-performance=1 enable-low-outbuffer=1 !'
'video/x-raw(memory:NVMM), format=(string)NV12 !'
'nvvidconv ! video/x-raw , format=(string)BGRx !'
'videorate ! video/x-raw, framerate=(fraction){}/1 !'
'videoconvert ! '
'appsink'). \
format(url, latency, framerate)
cap = cv2.VideoCapture(gstream_elemets, cv2.CAP_GSTREAMER)
then I decided to control the frame rate output with this : and I comment the ‘videorate ! video/x-raw, framerate=(fraction){}/1 !’ from above.
while cap.isOpened():
frame = cap.read()
sleep(1. / framerate)
With this way the cpu usage is dropped but I faced with incorrected decode frames, I attached the correct decode frame and incorrect decode frame. and I solved these problems(drop cpu usage and correct the decode frames) with leaky=0 (no leakage) but this cause a new problem as increased the gradually the memory, in my opinion, this is because the bottleneck in input and output frame rate,
Q1- How to solve this problem?
Q2- Is it possible to use deepstream-python-apps for decoding multi-stream for this part of my codes?