sahilparekh / GStreamer-Python

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

Doesn't work, while it works with a plain GST pipeline #7

Open neilyoung opened 2 years ago

neilyoung commented 2 years ago

Works:

gst-launch-1.0 rtspsrc location=rtsp://192.168.188.31:6554/trackID=0  ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert  autovideosink sync=false

Does not work:

Neils-MBP:GStreamer-Python neilyoung$ python3 main_prg.py 
Unexpected message received.
Pipeline state changed from null to ready.
Unexpected message received.
Pipeline state changed from ready to paused.
Unexpected message received.
Unexpected message received.
Unexpected message received.
Unexpected message received.
Unexpected message received.
Unexpected message received.
Unexpected message received.
0:00:00.489118000  9060 0x7fd5760c78c0 FIXME                default gstutils.c:4026:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Unexpected message received.
Unexpected message received.
Unexpected message received.
Unexpected message received.
neilyoung commented 2 years ago

Here the unexpected messages:

Neils-MBP:GStreamer-Python neilyoung$ python3 main_prg.py 
Unexpected message received. <flags GST_MESSAGE_LATENCY of type Gst.MessageType>
Pipeline state changed from null to ready.
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Pipeline state changed from ready to paused.
Unexpected message received. <flags GST_MESSAGE_NEW_CLOCK of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
0:00:00.495428000  9335 0x7fead986c4c0 FIXME                default gstutils.c:4026:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Unexpected message received. <flags GST_MESSAGE_STREAM_STATUS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_STREAM_STATUS of type Gst.MessageType>
Unexpected message received. <flags GST_MESSAGE_PROGRESS of type Gst.MessageType>
neilyoung commented 2 years ago

Well, yes. TCP is a very optimistic assumption...

And then this with 720p...

I420
720
1280
Traceback (most recent call last):
  File "/Users/neilyoung/Documents/Python/GStreamer-Python/vid_streamv3.py", line 78, in new_buffer
    arr = self.gst_to_opencv(sample)
  File "/Users/neilyoung/Documents/Python/GStreamer-Python/vid_streamv3.py", line 68, in gst_to_opencv
    arr = np.ndarray(
TypeError: buffer is too small for requested array