Lower latency suggestions using opencv and gstreamer

Michael MacIntosh mmacintosh at linear-systems.com
Fri Aug 11 18:06:16 UTC 2017


You could have a color conversion happening, which could add some 
overhead, you could try adding a queue between your videoconvert and 
your encoder to split them into other threads, or try outputting in a 
format so you don't need the videoconvert.

What kind of latency are you seeing?

Also if you just want to flip frames there is a videoflip element:

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-videoflip.html

Cheers,
Michael.


On 8/11/2017 10:25 AM, WisdomPill wrote:
> I'm trying to stream manipulated images from opencv and I came across a
> latency problem. I'm new to gstreamer and opencv and I was wondering if
> someone with more experience can tell me if I can improve the pipeline from
> a latency perspective.
> I think the pipeline is the problem here since there's no heavy processing
> in opencv, but I'm not sure about that.
> I'm using opencv-3.2 with python3 on a raspberry pi 3.
>
> My code is the following.
>
> import cv2
>
> cap = cv2.VideoCapture(0)
>
> framerate = 10.0
>
> out = cv2.VideoWriter('appsrc ! videoconvert ! '
>                        'x264enc bitrate=500 speed-preset=ultrafast
> quantizer=20 tune=zerolatency ! '
>                        'rtph264pay config-interval=1 pt=96 ! '
>                        'tcpserversink host=192.168.1.27 port=5000 ',
>                        0, framerate, (640, 480))
>
> while cap.isOpened():
>      ret, frame = cap.read()
>      if ret:
>          frame = cv2.flip(frame, 0)
>
>          # write the flipped frame
>          out.write(frame)
>
>          if cv2.waitKey(1) & 0xFF == ord('q'):
>              break
>      else:
>          break
>
> # Release everything if job is finished
> cap.release()
> out.release()
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Lower-latency-suggestions-using-opencv-and-gstreamer-tp4684168.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>



More information about the gstreamer-devel mailing list