gen2brain/cam2ip

Turn any webcam into an IP camera

Go

1,178

133 commits

updated Jul 4, 2026

See the code

README

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

Build tags

  • vfw - on Windows, use Video for Windows to access camera instead of the default Media Foundation
  • libjpeg - build with libjpeg (go-libjpeg) instead of native 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.

Usage

Usage: cam2ip [<flags>]
  --index
    	Camera index [CAM2IP_INDEX] (default "0")
  --device
    	Camera name to use, matched as substring, overrides index [CAM2IP_DEVICE] (default "")
  --delay
    	Delay between frames, in milliseconds [CAM2IP_DELAY] (default "10")
  --width
    	Frame width [CAM2IP_WIDTH] (default "640")
  --height
    	Frame height [CAM2IP_HEIGHT] (default "480")
  --quality
    	Image quality [CAM2IP_QUALITY] (default "75")
  --rotate
    	Rotate image, valid values are 90, 180, 270 [CAM2IP_ROTATE] (default "0")
  --flip
    	Flip image, valid values are horizontal and vertical [CAM2IP_FLIP] (default "")
  --no-webgl
    	Disable WebGL drawing of image (html handler) [CAM2IP_NO_WEBGL] (default "false")
  --timestamp
    	Draws timestamp on image [CAM2IP_TIMESTAMP] (default "false")
  --time-format
    	Time format [CAM2IP_TIME_FORMAT] (default "2006-01-02 15:04:05")
  --bind-addr
    	Bind address [CAM2IP_BIND_ADDR] (default ":56000")
  --htpasswd-file
    	Path to htpasswd file, if empty auth is disabled [CAM2IP_HTPASSWD_FILE] (default "")
  --add-user
    	Add a user to the htpasswd file (with --htpasswd-file) and exit (default "")
  --lazy
    	Open the camera only while clients are connected [CAM2IP_LAZY] (default "false")
  --list-devices
    	List available cameras and exit (default "false")
  --version
    	Print version and exit (default "false")

Handlers

  • /html: HTML handler, frames are pushed to canvas over websocket
  • /jpeg: Static JPEG handler
  • /mjpeg: Motion JPEG, supported natively in major web browsers

camview

cmd/camview is a small native window that shows the local camera live, using iv for display.

go install github.com/gen2brain/cam2ip/cmd/camview@latest
camera
mjpeg
webcam

gen2brain/cam2ip

Turn any webcam into an IP camera

Go

1,178

133 commits

updated Jul 4, 2026

See the code

README

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

Build tags

  • vfw - on Windows, use Video for Windows to access camera instead of the default Media Foundation
  • libjpeg - build with libjpeg (go-libjpeg) instead of native 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.

Usage

Usage: cam2ip [<flags>]
  --index
    	Camera index [CAM2IP_INDEX] (default "0")
  --device
    	Camera name to use, matched as substring, overrides index [CAM2IP_DEVICE] (default "")
  --delay
    	Delay between frames, in milliseconds [CAM2IP_DELAY] (default "10")
  --width
    	Frame width [CAM2IP_WIDTH] (default "640")
  --height
    	Frame height [CAM2IP_HEIGHT] (default "480")
  --quality
    	Image quality [CAM2IP_QUALITY] (default "75")
  --rotate
    	Rotate image, valid values are 90, 180, 270 [CAM2IP_ROTATE] (default "0")
  --flip
    	Flip image, valid values are horizontal and vertical [CAM2IP_FLIP] (default "")
  --no-webgl
    	Disable WebGL drawing of image (html handler) [CAM2IP_NO_WEBGL] (default "false")
  --timestamp
    	Draws timestamp on image [CAM2IP_TIMESTAMP] (default "false")
  --time-format
    	Time format [CAM2IP_TIME_FORMAT] (default "2006-01-02 15:04:05")
  --bind-addr
    	Bind address [CAM2IP_BIND_ADDR] (default ":56000")
  --htpasswd-file
    	Path to htpasswd file, if empty auth is disabled [CAM2IP_HTPASSWD_FILE] (default "")
  --add-user
    	Add a user to the htpasswd file (with --htpasswd-file) and exit (default "")
  --lazy
    	Open the camera only while clients are connected [CAM2IP_LAZY] (default "false")
  --list-devices
    	List available cameras and exit (default "false")
  --version
    	Print version and exit (default "false")

Handlers

  • /html: HTML handler, frames are pushed to canvas over websocket
  • /jpeg: Static JPEG handler
  • /mjpeg: Motion JPEG, supported natively in major web browsers

camview

cmd/camview is a small native window that shows the local camera live, using iv for display.

go install github.com/gen2brain/cam2ip/cmd/camview@latest
camera
mjpeg
webcam

Project health

Latest release

v1.7.0 · Jun 30, 2026

Releases this year

1

Significant stargazers

Roger Coll

47 followers · starred Apr 2025

Giau. Tran Minh

149 followers · starred Jul 2026

杨屿杰

7 followers · starred Jul 2019

Carlos Cobo

113 followers · starred Jul 2021