Turn any webcam into an IP camera.
Example (in web browser):
http://localhost:56000/mjpeg
or
http://localhost:56000/html
- libjpeg-turbo (use
-tags jpeg
to build withoutCGo
) - On Linux/RPi native Go V4L implementation is used to capture images.
- On Windows Video for Windows (VfW) framework is used over win32 API.
go get -u github.com/gen2brain/cam2ip
cv2
- build withOpenCV
2.x (go-opencv)cv3
- build withOpenCV
3.x (gocv)jpeg
- build with native Goimage/jpeg
instead oflibjpeg-turbo
Binaries are compiled with static OpenCV/libjpeg-turbo libraries, they should just work:
- Linux 64bit
- Linux 64bit OpenCV
- RPi 32bit
- RPi 32bit OpenCV
- RPi 32bit Static
- RPi3 32bit
- RPi3 32bit OpenCV
- Windows 32bit
- Windows 32bit OpenCV
- Windows 64bit
- Windows 64bit OpenCV
go get -v github.com/gen2brain/cam2ip
This will install app in $GOPATH/bin/cam2ip
.
docker run --device=/dev/video0:/dev/video0 -p56000:56000 -it gen2brain/cam2ip # on RPi use gen2brain/cam2ip:arm
Usage of ./cam2ip:
-bind-addr string
Bind address (default ":56000")
-delay int
Delay between frames, in milliseconds (default 10)
-height float
Frame height (default 480)
-width float
Frame width (default 640)
-htpasswd-file string
Path to htpasswd file, if empty auth is disabled
-index int
Camera index
-nowebgl
Disable WebGL drawing of images (html handler)
-rotate int
Rotate image, valid values are 90, 180, 270
-video-file string
Use video file instead of camera
/html
: HTML handler, frames are pushed to canvas over websocket/jpeg
: Static JPEG handler/mjpeg
: Motion JPEG, supported natively in major web browsers