Hi, I would like to create a small app that displays an http video stream coming from a remote Pi running mjpg-streamer
I’ve got a look at ofxIpVideoGrabber, but I’m not sure if this addon will be able to compile and run on a Pi.
Furthermore, I really wonder if I need a full blown addon, provided that few lines of Python seems to do the job :
import cv2
import urllib
import numpy as np
stream=urllib.urlopen('http://192.168.1.90:8080/?action=stream')
bytes=''
while True:
bytes+=stream.read(1024)
a = bytes.find('\xff\xd8')
b = bytes.find('\xff\xd9')
if a!=-1 and b!=-1:
jpg = bytes[a:b+2]
bytes= bytes[b+2:]
i = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8),cv2.CV_LOAD_IMAGE_COLOR)
cv2.imshow('i',i)
if cv2.waitKey(1) ==27:
exit(0)
While the above code works OK on a Pi it has two drawbacks :
it relies on openCV
it works only under XWindow and is very slow
I just would like a very simple piece of of code to decode the stream and get (for each frame) an image I could project on a texture… Any barebone addon anywhere ? I may have missed a message in the forums but I didn’t found anything…
BTW, the audio stream is captured from a webcam - Whilst mjpg-streamer does a good job (it’s very fast) I wonder how difficult it would be to create a live broadcaster with OF instead…