I used gstreamer and capture images from network camera by :
gst-launch-1.0 -e rtspsrc location='rtsp://admin:admin@10.0.4.139:554/cam/realmonitor?channel=1&subtype=0' ! rtph264depay ! vpudec ! vpuenc_jpeg ! filesink location=/dev/video_stream0 -v
/dev/video_stream0 is mkfifo but when I want to grab jpeg from OpenCv by code:
import cv2
cap = cv2.VideoCapture('/dev/video_stream0')
#cap = cv2.CreateFileCapture('/dev/video_stream0')
count = 0
while cap.isOpened():
ret,frame = cap.read()
cv2.imshow('window-name',frame)
#cv2.imwrite("frame%d.jpg" % count, frame)
count = count + 1
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cap.destroyAllWindows()
It gives me error
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/user/fsl-release-bsp/build-mcd/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/highgui/src/window.cpp, line 261
How can I share for example jpegs between gstreamer and OpenCv? If there is simpler way like sharing video stream or emulate camera device I will be gratefull. Thank You