ZBARCAM(1)

πŸ’– ZBARCAM β€” bestie's guide to scanning barcodes off a webcam πŸ’–

okay so. you know how your laptop has a camera and barcodes exist? yeah. this is the thing that marries them. it's zbarcam, from the ZBar Barcode Reader fam, and she is that girl. πŸŽ€


✨ NAME ✨

zbarcam β€” scan and decode bar codes from a video device πŸ¦‹


🌸 SYNOPSIS 🌸

zbarcam [-qv] [--quiet] [--nodisplay] [--xml] [--verbose[=n]]
        [--prescale=WxH] [-S[symbology.]config[=value]]
        [--set [symbology.]config[=value]] [device]

zbarcam {-h | --help | --version}

πŸ‘‘ DESCRIPTION πŸ‘‘

so zbarcam points itself at a video4linux video source (like, a webcam, bestie) and hunts for bar codes in the video stream. when it finds one it prints the decoded data to standard output. and yes, it also shows you the video on your screen, so you get the whole aesthetic while it works. πŸ’…

device is the path to the video4linux (version 1 or 2) character device special file β€” that's major number 81 and minor number 0 thru 63 for those of you taking notes. it defaults to /dev/video0. slay.

the underlying library currently supports these symbologies: EAN-13 (including UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128, Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code. the specific type of each detected symbol gets printed right alongside the decoded data, so you always know what you're looking at. ✨


πŸ’œ OPTIONS πŸ’œ

this program follows the usual GNU command line syntax. single letter options may be bundled, long options start with two dashes (-). periodt.

  • -h, --help β€” prints a short help message describing the command line options to standard output, then exits. the classic.
  • --version β€” prints program version information to standard output and exits. go off.
  • -v, --verbose[=n] β€” cranks up the debug output level. stack multiple -v options for more spew 🌈. or just hand it n to set the debug level directly, if you're a direct-communication kinda girl.
  • -S[symbology.]config[=value], --set [symbology.]config[=value] β€” sets decoder configuration option config for symbology to value. if you skip value it defaults to 1. symbology is one of ean13, ean8, upca, upce, isbn13, isbn10, i25, codabar, code39, code93, code128, qrcode, or the special value *. if symbology is omitted or is *, the config gets set for all applicable symbologies. prefix a config with "no-" to negate it. heads up: not all configs are appropriate for every symbology. πŸ™ˆ

here are the currently recognized configs:

  • enable β€” controls decoding/reporting of a symbology. for the symbologies that are literally just subsets of ean13 (upca, upce, isbn13, isbn10), this config controls whether the subsets are detected and reported as such. these special cases are disabled by default; all other symbologies default to enabled.
  • disable β€” antonym for enable. πŸ’€
  • emit-check β€” controls whether check digits are included in the decoded output. enabled by default. this config does not apply for code128, which never returns the check digit. it also does not apply in cases where the check digit is disabled (see add-check). check digits are currently not implemented for i25 or code39.
  • add-check β€” enables decode and verification of a check digit for symbologies where it's optional: this will include code39 and i25, neither of which implements the check digit yet. 😭
  • ascii β€” enables escape sequences that encode the full ASCII character set. this would apply to code39, except that it's not implemented either... 🫠
  • position β€” enables collection of symbol position information. enabled by default. currently the position information is unusable, so you can save a few cycles by disabling this. lowkey free performance, ngl.
  • test-inverted β€” specially for QR code images, because sometimes the image is inverted, e. g. lines are written in white instead of black. this option makes ZBar invert the image and parse again, in case it fails using the normal order. enabling it affects all decoders.
  • min-length=n, max-length=n β€” bound the number of decoded characters in a valid symbol. if a decode result lands outside the configured min/max range (inclusive), it will not be reported. set to 0 to disable the corresponding check. this setting applies to variable-length symbologies: i25, codabar, code39, code128 and pdf417. min-length defaults to 6 for i25 and 1 for code39 (per the Code 39 autodiscrimination recommendation); all others default to 0.
  • x-density=n, y-density=n β€” adjust the density of the scanner passes. lower values scan more of the image at the cost of decreased performance. setting to 0 disables scanning along that axis. defaults are both 1.
  • -q, --quiet β€” quiet operation; disables the audible beep that otherwise goes off when a symbol is decoded. πŸ“
  • --nodisplay β€” disables the output video window. video input will be scanned until the program is interrupted or otherwise signaled. main character energy, no audience required.
  • --xml β€” streams results using an XML output format. this format wraps the raw data from the symbol with information about the scan in an easy to parse format. the latest schema is available from http://zbar.sourceforge.net/2008/barcode.xsd
  • --raw β€” uses the raw symbol data output format. this format prints symbol data separated by newlines without the additional symbology type information that's printed by default. minimalism, we love her.
  • --prescale=WxH β€” requests video input scaling from the camera driver. possibly useful for reducing huge frames to achieve a higher frame rate. note that the driver may adjust or completely ignore the scaling request. πŸ™ƒ

🧚 EXAMPLES 🧚

scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:

zbarcam /dev/video1 | upcrpc.py

the upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found. iconic.

scan for barcodes using the default video device and stream results to stdout in XML format, also disable recognition of Interleaved 2 of 5 codes to prevent confusion with other symbologies or background noise:

zbarcam --xml -Si25.disable

scan only for Code 39, without using the preview window β€” maybe for a fixed installation. to enable only Code 39, first all symbologies are disabled, then Code 39 is re-enabled:

zbarcam --nodisplay -Sdisable -Scode39.enable

see how it works? disable everything, then let exactly one girl through the door. πŸ’…βœ¨


🌈 EXIT STATUS 🌈

zbarcam returns an exit code to indicate the status of the program execution. current exit codes are:

  1. 0 β€” Successful program completion. πŸŽ‰
  2. 1 β€” An error occurred. this includes bad arguments and I/O errors.
  3. 2 β€” A fatal error occurred. 😭

πŸ”₯ SEE ALSO πŸ”₯


πŸ’€ BUGS πŸ’€

see http://sf.net/tracker/?group_id=189236&atid=928515


πŸŽ€ AUTHOR πŸŽ€

Jeff Brown <spadix@users.sourceforge.net> Lead developer πŸ‘‘


Copyright Β© 2007-2010 Jeff Brown

All Rights Reserved


okay bestie that's the whole page, no cap. this was zbar-0.23.95, dated 2017-04-11, and it's the ZBARCAM(1) manual page from the ZBar Barcode Reader. go scan something cute. πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from