Lower latency suggestions using opencv and gstreamer

WisdomPill anas.el.amraoui at live.com
Fri Aug 11 17:25:43 UTC 2017


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.


More information about the gstreamer-devel mailing list