cam2ip: Turn any Webcam into a full-featured IP Camera
This is a simple project that will help you turn any Webcam into an IP Camera that you can access from anywhere.
The project is written using Go language, and works on Windows, Linux, macOS, and Raspberry Pi.
Requirements
- 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.
License
cv2
- build withOpenCV
2.x (go-opencv)cv4
- build withOpenCV
4.x (gocv)jpeg
- build with native Goimage/jpeg
instead oflibjpeg-turbo
Download
Binaries are compiled with static OpenCV/libjpeg-turbo libraries, they should just work:
- Linux 64bit
- Linux 64bit OpenCV
- macOS 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
Installation
go get -v github.com/gen2brain/cam2ip/cmd/cam2ip
Run using Docker
docker run --device=/dev/video0:/dev/video0 -p56000:56000 -it gen2brain/cam2ip # on RPi use gen2brain/cam2ip:arm
Usage
Usage of cam2ip:
-bind-addr string
Bind address [CAM2IP_BIND_ADDR] (default ":56000")
-delay int
Delay between frames, in milliseconds [CAM2IP_DELAY] (default 10)
-height float
Frame height [CAM2IP_HEIGHT] (default 480)
-htpasswd-file string
Path to htpasswd file, if empty auth is disabled [CAM2IP_HTPASSWD_FILE]
-index int
Camera index [CAM2IP_INDEX]
-nowebgl
Disable WebGL drawing of images (html handler) [CAM2IP_NOWEBGL]
-rotate int
Rotate image, valid values are 90, 180, 270 [CAM2IP_ROTATE]
-timestamp
Draws timestamp on images [CAM2IP_TIMESTAMP]
-video-file string
Use video file instead of camera [CAM2IP_VIDEO_FILE]
-width float
Frame width [CAM2IP_WIDTH] (default 640)
Handlers
/html
: HTML handler, frames are pushed to canvas over websocket/jpeg
: Static JPEG handler/mjpeg
: Motion JPEG, supported natively in major web browsers