how to stream frames using gstreamer 2c with opencv in python 3f

Solutions on MaxInterview for how to stream frames using gstreamer 2c with opencv in python 3f by the best coders in the world

showing results for - "how to stream frames using gstreamer 2c with opencv in python 3f"
Carolina
08 Sep 2017
1"""How to stream frames using gstreamer, with opencv in python?
2https://forums.developer.nvidia.com/t/how-to-stream-frames-using-gstreamer-with-opencv-in-python/121036/2
3"""
4
5import cv2
6
7cap = cv2.VideoCapture("rtsp://admin:xxxx@10.168.1.248:554/h264/ch1/main/av_stream")
8
9out = cv2.VideoWriter("appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw, format=BGRx ! nvvidconv ! omxh264enc ! video/x-h264, stream-format=byte-stream ! h264parse ! rtph264pay pt=96 config-interval=1 ! udpsink host=10.168.1.177 port=50001", cv2.CAP_GSTREAMER, 0, 25.0, (1920,1080))
10
11while cap.isOpened():
12    ret, frame = cap.read()
13    if ret:
14        if out.isOpened():
15            out.write(frame)
16            print('writing frame')
17        if cv2.waitKey(1) & 0xFF == ord('q'):
18            break
19    else:
20        break
21
22# Release everything if job is finished
23cap.release()
24out.release()
25
similar questions