Milan Nikolic 711ad2f102 Add jpegli
2025-06-13 18:42:00 +02:00
2025-06-13 17:58:10 +02:00
2024-01-30 15:55:20 +01:00
2021-01-21 15:51:16 +01:00
2025-06-13 18:42:00 +02:00
2018-01-27 03:28:09 +01:00
2023-03-17 14:32:44 +01:00
2017-10-03 20:50:11 +02:00
2017-10-03 20:50:11 +02:00
2019-10-06 06:52:35 +02:00
2025-06-13 18:42:00 +02:00
2025-06-13 18:42:00 +02:00
2024-01-30 16:15:24 +01:00
2025-06-13 18:42:00 +02:00

cam2ip

Turn any webcam into an IP camera.

Example (in web browser):

http://localhost:56000/html

or

http://localhost:56000/mjpeg

You can also use apps like ffplay or vlc:

ffplay -i http://localhost:56000/mjpeg

Requirements

  • On Linux/RPi native Go V4L implementation is used to capture images.
  • On Windows Video for Windows (VfW) framework is used over win32 API.

Build tags

  • opencv - use OpenCV library to access camera (gocv)
  • libjpeg - build with libjpeg (go-libjpeg) instead of native Go image/jpeg
  • jpegli - build with jpegli (go-libjpeg) instead of native Go image/jpeg

Download

Download the latest binaries from the releases.

Installation

go install github.com/gen2brain/cam2ip/cmd/cam2ip@latest

This command will install cam2ip in GOBIN, you can point GOBIN to e.g. /usr/local/bin or ~/.local/bin.

Run in Docker container

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]
  -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
Description
Turn any webcam into an IP camera
Readme 339 KiB
Languages
Go 91.6%
Shell 7.8%
Dockerfile 0.6%