The below gstreamer command plays the video directly on the terminal:
gst-launch-1.0 rtspsrc location=rtsp://username:password@192.168.1.225:554/profile2/media.smp ! rtph264depay ! h264parse ! omxh264dec ! nvoverlaysink -e
Jtop output session shows that the Hardware Encoder is running:
The below playbin command works:
gst-launch-1.0 -v playbin uri=rtsp://username:password@192.168.1.225:554/profile2/media.smp
I am able to open the rtsp stream in the VLC player without any issues.
Also, I am able to open the camera without hardware acceleration. The CPU utilisation without HW decoding is about 70 to 80%.
When I integrate the stream into the python code, I am getting an error code. The python code is as below:
import cv2
pipeline = ‘rtspsrc location=rtsp://username:password@192.168.1.225:554/profile2/media.smp ! rtph264depay ! h264parse ! omxh264dec ! appsink’
capture = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)
while capture.isOpened():
res, frame = capture.read()
cv2.imshow(“Video”, frame)
key = cv2.waitKey(1) & 0xFF
if key == ord(“q”):
break
capture.release()
cv2.destroyAllWindows()
I am getting the below error code:
(python3:7616): GStreamer-CRITICAL **: 20:28:10.657: gst_caps_is_empty: assertion ‘GST_IS_CAPS (caps)’ failed
(python3:7616): GStreamer-CRITICAL **: 20:28:10.658: gst_caps_truncate: assertion ‘GST_IS_CAPS (caps)’ failed
(python3:7616): GStreamer-CRITICAL **: 20:28:10.658: gst_caps_fixate: assertion ‘GST_IS_CAPS (caps)’ failed
(python3:7616): GStreamer-CRITICAL **: 20:28:10.658: gst_caps_get_structure: assertion ‘GST_IS_CAPS (caps)’ failed
(python3:7616): GStreamer-CRITICAL **: 20:28:10.658: gst_structure_get_string: assertion ‘structure != NULL’ failed
(python3:7616): GStreamer-CRITICAL **: 20:28:10.658: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Allocating new output: 1920x1088 (x 11), ThumbnailMode = 0
OPENMAX: HandleNewStreamFormat: 3605: Send OMX_EventPortSettingsChanged: nFrameWidth = 1920, nFrameHeight = 1080
[ WARN:0] global /home/username/test/workspace/opencv-4.5.0/modules/videoio/src/cap_gstreamer.cpp (1761) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module omxh264dec-omxh264dec0 reported: Internal data stream error.
[ WARN:0] global /home/username/test/workspace/opencv-4.5.0/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/username/test/workspace/opencv-4.5.0/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Please help me to resolve the issue.
Thank you