webcam(1)

πŸ“¦
version 3.107 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– webcam(1) β€” General Commands Manual πŸ’–

okay bestie, sit down, hydrate, because we're about to make your webcam upload pictures to the internet like it's 2002 and that's iconic actually. this is the manual page for webcam, and it lives in the General Commands Manual section, and honestly? she's serving.


✨ NAME ✨

webcam β€” capture images and upload them to a webserver using ftp


🌸 SYNOPSIS 🌸

webcam [ config file ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so webcam grabs images from a video4linux device (think bttv and friends), annotates them, and uploads them to a webserver using ftp. and then it does it again. and again. and again. forever. it's an endless loop, no cap. she literally never stops. main character energy, truly. πŸ”₯


πŸŽ€ CONFIGURATION πŸŽ€

at startup, webcam reads its configuration from the config file you handed it on the command line. if you didn't give her one? she goes looking at ~/.webcamrc instead. ngl she's flexible like that. πŸ’…

the config file has at least two sections. let's break it down:

  • the "grab" section holds all the capture parameters.
  • any other section describes where the image should be uploaded.

okay so tea time β˜• β€” older versions used "ftp" as the name for that upload section. but recently webcam got support for multiple connections, so now any section name is accepted, and you can have more than one ftp section (you just have to use a different name for each one though β€” name them by upload server, for example). yes bestie, you can multistream. obsessed. 😭

here's a sample config file, and the values shown are the defaults:

[grab]
device = /dev/video0
driver = libv4l
text = "webcam %Y-%m-%d %H:%M:%S"
infofile = filename
fg_red = 255
fg_green = 255
fg_blue = 255
width = 320
height = 240
delay = 3
wait = 0
input = composite1
norm = pal
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 75
trigger = 0
once = 0

[ftp]
host = www
user = webcam
pass = xxxxxx
dir  = public_html/images
file = webcam.jpeg
tmp  = uploading.jpeg
passive = 1
debug = 0
auto = 0
local = 0
ssh = 0

the annotation text gets processed with strftime. go check the strftime(3) or date(1) manpage to see how you can format those timestamps ✨. you can also read the text from an extern file (just use infofile for that).

the default color for the text overlay is white, aka RGB=255,255,255. entries in the range of 0 through 255 for fg_red, fg_green, and fg_blue can be used to define a different color. likewise bg_red, bg_green, and bg_blue can be used to set the background color (which defaults to transparent). cute. 🌈

  • input is the video source (TV/composite/whatever), and norm is the TV norm.
  • delay is the delay between two images, in seconds.
  • wait is the initial delay before the first image is grabbed β€” because some cameras need a sec to adapt to the lighting, so they don't return images with reasonable quality within the first few seconds... yes she's a diva, let her warm up. πŸ™ˆ
  • quality is the JPEG quality for the stored images.

top, bottom, left, and right in the grab section let you crop the image after it's grabbed. they should satisfy 0<=top<bottom<=height and 0<=left<right<=width. (0,0 is the top, left corner, iykyk). if rotate is positive, the output image will be rotated counter-clockwise 90 degrees that number of times (1, 2, or 3).

with trigger set to a non-zero value, webcam will upload the image only if the content of the image has changed. she just looks for the maximum difference between the last uploaded image and the current image, and if it's greater than the specified value, the image gets uploaded. if once is set to 1, webcam will upload a single frame and quit. one and done, periodt. πŸ’…

archive can be used to create a (local) archive of the webcam images β€” just specify the filename for the files as the argument. that filename will be processed with strftime(3), so you can place the usual time format controls into the string to get unique filenames πŸŽ€. non-existing directories are created if needed.

if debug in the ftp section is set to 1, the complete communication between webcam and the ftp utility gets printed to stderr. auto enables autologin via ~/.netrc (it starts the ftp utility without the '-n' switch β€” check the ftp(1) man page for more info about the ~/.netrc file). if local in the ftp section is non-zero, files will be stored locally (using the dir, tmp, and file parameters) rather than ftped. and ssh set to non-zero makes webcam use ssh instead of ftp. choices, we love choices. ✨


🧚 CORRECTION OF DISTORTION 🧚

contributed by Frederic Helin β€” and heads up bestie, these parameters belong in the [grab] section of the config file too.

  • distor = 1 β€” if distor param is set to 1, the correction of distortion works.
  • distor_k = 700 β€” this is the coefficient of distortion. this algorithm is based on the paper "Correcting Distortion of Image by Image Registration" of Toru Tamaki, Tsuyoshi Yamamura and Noboru Ahnishi. more your lens has an important distortion, more 'distor_k' must be neared of 0. 700 is the default value. coefficient k of program is x100 than article.
  • distor_cx = 192
  • distor_cy = 144 β€” coordinates of the lens optical axis: width/2 and height/2 are the default values. the axis doesn't go through the image center. so, you can change its coordinates around the center of image to affine correction.
  • distor_zoom = 30 β€” zoom parameter is used to cache the distorted borders of image, if you don't like this. default value is 100.
  • distor_sensorw = 320
  • distor_sensorh = 240 β€” dimensions of camera sensor. default values are for 1/4p sensor. this parameters used to have the same k coefficient than article.

πŸ‘‘ AUTHOR πŸ‘‘

Gerd Knorr <kraxel@bytesex.org>


Copyright (C) 1997-2002 Gerd Knorr
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
no warranty bestie, she said what she said. 😭

okay that's the whole page!! πŸ’– this copyright situation is (c) 1998-2000 Gerd Knorr, and the page you just read is webcam(1) from the General Commands Manual. go forth and stream your webcam, queen. slay. πŸŽ€βœ¨πŸ¦‹