VideoStreamer

javadoc

The video streamer service can stream a video source in MJPEG format.  In order to stream the video, it needs to be attached to a video source.  By default it will stream to port 9090.  Most "real" browsers have the ability to display the video feed.

If you have a webcam, you can start an OpenCV service which will be the video source.  Start the video streamer and attach it to the OpenCV service.  Start a browser and go to http://localhost:9090/output , you should be able to see the video from the camera.

[[VideoStreamer.py]]

Examples:


#file : service/VideoStreamer.py edit raw
from org.myrobotlab.service import Runtime
from org.myrobotlab.service import OpenCV
from org.myrobotlab.service import VideoStreamer
from time import sleep
from org.myrobotlab.net import BareBonesBrowserLaunch

# create a video source (opencv) & a video streamer
opencv = Runtime.createAndStart("opencv","OpenCV")
streamer = Runtime.createAndStart("streamer","VideoStreamer")

# attache them
streamer.attach(opencv)

# add a pyramid down filter and gray to minimize the data
opencv.addFilter("pyramidDown", "PyramidDown");
opencv.addFilter("gray", "Gray");

# start the camera
opencv.capture();
#added sleep in order to give opencv the time to "warm up" the cam
sleep(3)


# go to http://localhost:9090/output
BareBonesBrowserLaunch.openURL("http://localhost:9090")

Alessandruino's picture

This is the beginning of the

This is the beginning of the "revolution"... The problem of obsolete examples and projects is resolved !!!

GroG, You ROCK !!!

We will be happy monkeys... Yeah for WORKY examples!!!

GroG's picture

VIVA LA REVOLUCION !

ONE LESS CLICKY !

Alessandruino's picture

THIS SISSY SCRIPT DOESN'T

THIS SISSY SCRIPT DOESN'T WORK :D

HERE IS THE WORKY ONE :D

 

from org.myrobotlab.service import OpenCV
from org.myrobotlab.opencv import OpenCVData
from java.lang import String
from java.lang import Class
opencv = runtime.createAndStart("opencv","OpenCV")
opencv.addFilter("pd","PyramidDown")
opencv.setDisplayFilter("pd")
opencv.addFilter("gray","Gray")
opencv.setDisplayFilter("gray")
opencv.capture()
streamer = runtime.createAndStart("streamer","VideoStreamer")
streamer.setPort(9090)
streamer.start()
streamer.attach(opencv)
GroG's picture

The SISSY SCRIPT DOES WORK

The SISSY SCRIPT DOES WORK !

You just forgot to update to the latest version !!!! :D