I have flir blackfly s bfs-pge-04s2c-cs model ip camera. I have poe injector that is connected to router and to camera. I can find the camera ip. My problem is I cannot connect with rtsp.
with EasyPySpin I can get a frame with the code below.
import cv2
import EasyPySpin
cap = EasyPySpin.VideoCapture(0)
print(cap.get(0))
for i in range(100):
ret, frame = cap.read()
cv2.imwrite("frame.png", frame)
cap.release()
I need rtsp connection for my other processes the ip is shown with the matched mac adress in my system. I tried like that
import cv2
import os
RTSP_URL = 'rtsp://192.168.1.240'
os.environ['OPENCV_FFMPEG_CAPTURE_OPTIONS'] = 'rtsp_transport;udp'
cap = cv2.VideoCapture(RTSP_URL, cv2.CAP_FFMPEG)
if not cap.isOpened():
print('Cannot open RTSP stream')
exit(-1)
while True:
_, frame = cap.read()
print('hehe')
cv2.imshow('RTSP stream', frame)
if cv2.waitKey(1) == 27:
break
cap.release()
cv2.destroyAllWindows()
I cannot make a connection with this code.
Turns out Blackfly S GigE does not support rtsp streaming. It uses GVSP that is a protocol for gige streaming.
I manually created an rtsp server with simple rtsp server written in Go language then used gstreamer pipeline with aravis plugin.
gst-launch-1.0 aravissrc ! video/x-raw,format=RGB ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast ! rtspclientsink protocols=tcp location=rtsp://localhost:8554/flir