zbarcam — scan and decode bar codes from a video device
zbarcam [-qv] [--quiet] [--nodisplay] [--xml] [--verbose[=] [n]--prescale=] [WxH-S[] [symbology.]config[=value]--set [] [symbology.]config[=value]device]
zbarcam { -h | --help | --version }
zbarcam scans a video4linux video source (eg, a webcam) for bar codes and prints any decoded data to the standard output. The video stream is also displayed to the screen.
device is the
path to the video4linux (version 1 or 2) character device special
file (major number 81 and minor number 0 thru 63). It defaults to
/dev/video0
The underlying library currently supports EAN-13 (including UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128, Code 93, Code 39, Codabar, Interleaved 2 of 5, QR Code, PCard and PCard2 symbologies. The specific type of each detected symbol is printed with the decoded data.
PCard and PCard2 decodings are supported by the underlying library,
but they are not enabled by default for zbarcam.
To scan PCard
symbols explicitly use -Spcard.enable=1 or
--set pcard.enable=1.
This program follows the usual GNU command line syntax. Single letter options may be bundled, long options start with two dashes (`-').
-h, --help--version-v, --verbose[=n]-v options create more spew. Alternatively
specify n to
set the debug level directly
-S[symbology.]config[=value], --set [symbology.]config[=value]Set decoder configuration option config for symbology to value. value defaults to 1 if omitted.
symbology is one of
ean13, ean8,
upca, upce,
isbn13, isbn10,
i25, codabar, code39,
code93, code128,
qrcode, pcard, pcard2
or the special value *.
If symbology is
omitted or *, the config will be set for all
applicable symbologies. These are the currently recognized
configs. Prefix a
config with "no-" to negate it. Not all configs are appropriate
for every symbology.
enableean13
(upca, upce,
isbn13, isbn10), this
config controls whether the subsets are detected and
reported as such. These special cases are disabled by
default. PCard and PCard2 are also disabled by default in the scanner.
All other symbologies default to enabled.disableenableemit-checkcode128, which never returns the
check digit. It also not apply for cases where the check
digit is disabled (see add-check). Check
digits are currently not implemented for
i25 or code39.
pcard and pcard2
have no checking at all.add-checkcode39 and i25, neither of
which implements the check digit yetasciicode39,
except that it's not implemented either...positionmin-length=n, max-length=ni25, codabar,
code39, code128 and
pdf417. min-length defaults to 6
for i25 and 1 for code39 (per Code
39 autodiscrimination recommendation); all others default to
0x-density=n, y-density=n-q, --quiet--nodisplay--xml--raw--prescale=WxHScan 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.
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
To enable PCard decoding (or PCard2 by analogy), use:
zbarcam--nodisplay-Spcard.enable=1
zbarcam returns an exit code to indicate the status of the program execution. Current exit codes are:
Successful program completion.
An error occurred. This includes bad arguments and I/O errors.
A fatal error occurred.
PCard2 is similar to PCard in most aspects. A barcode consists of 4 bars. The widths are 1 or 2 units, the same with white bars.
PCard and PCard2 should not be enabled in the same time. The issue it would cause is not due to barcodes themselves, but due to card images. The king of clubs in PCard has a sword, which matches the PCard2 barcode of ten of hearts. Both codes would be detected which may interfere with subsequent processing.