sahilparekh / GStreamer-Python

Fetch RTSP Stream using GStreamer in Python and get image in Numpy
MIT License
124 stars 36 forks source link

CPU usage is too high #6

Open dexception opened 4 years ago

dexception commented 4 years ago

For 1920x1080 resolution.

The CPU is around 2 i7 cores. May the pipeline configured with TCP/UDP connection will yield more efficiency.

ThiagoMateo commented 3 years ago

Do you solve this problem? i try to decode with nvidia accelerate by changing

 self.pipeline = Gst.parse_launch(
            'rtspsrc name=m_rtspsrc ! rtph264depay name=m_rtph264depay ! avdec_h264 name=m_avdech264 ! videoconvert name=m_videoconvert ! videorate name=m_videorate ! appsink name=m_appsink')

to

 self.pipeline = Gst.parse_launch(
            'rtspsrc name=m_rtspsrc ! rtph264depay name=m_rtph264depay ! nvv4l2decoder name=m_avdech264 ! nvvideoconvert name=m_videoconvert ! videorate name=m_videorate ! appsink name=m_appsink')

but there are some error like below:

TypeError: buffer is too small for requested array
Traceback (most recent call last):
  File "/data/vid_streamv3.py", line 78, in new_buffer
    arr = self.gst_to_opencv(sample)
  File "/data/vid_streamv3.py", line 73, in gst_to_opencv
    dtype=np.uint8)
TypeError: buffer is too small for requested array
Caught Keyboard interrupt