# Analogue To Digital

# 1 Still Image

See also camera.

# 1.1 LiDE 35

USB flatbed scanner, a few mm above A4 size. lsusb says:

ID 04a9:2213 Canon, Inc. CanoScan LiDE 50/LiDE 35/LiDE 40

Uses genesys sane backend.

SANE is the system to access scanners on Linux.

Debian Trixie has a regression in sane-backends (upstream problem):

Supported modes Gray (default), Color.

Supported bit depth: 8 (default), 16

Supported DPI (time to scan A4 page as 8bit RGB, size of output PPM):

  • 2400 (381s, 1600M)
  • 1200 (207s, 400M)
  • 600 (73s, 100M)
  • 300 (51s, 25M)
  • 200 (43s, 12M)
  • 150 (40s, 6.3M)
  • 75 (37s, 1.6M)

Gray takes the same time as RGB but output PGM are 3x smaller.

16bit depth takes the same time but output files are 2x bigger.

# 1.1.1 Buttons

scanbd is a daemon that polls scanner buttons and proxies scanner access to saned.

It was a struggle to get working. Tips on:

Ignore the step

copy all configuration files from /etc/sane.d/ to /etc/scanbd/sane.d/ (these will be needed later):

because this is done automatically by the Debian package.

/etc/sane.d/dll.conf should contain just net; when proxied by scanbd sane uses /etc/scanbd/dll.conf which should contain the scanner backend (in my case, genesys).

/etc/sane.d/net.conf should contain:

connect_timeout = 5
localhost
[::]

Forcing systemd to use IPv4 (with ListenStream=address:port) instead of IPv6 (default with just ListenStream=port) helped:

$ grep 6566 /etc/systemd/system/sockets.target.wants/scanbm.socket 
ListenStream=127.0.0.1:6566

/etc/inetd.conf should contain:

sane-port stream tcp nowait scanbd.scanner /usr/sbin/scanbm scanbm
sane-port stream tcp6 nowait scanbd.scanner /usr/sbin/scanbm scanbm

Here’s my /etc/scanbd/scripts/test.script, which scans A4 at 300dpi RGB (25MB PPM), then makes a 100dpi processed PNG suitable for text documents (typically ~200kB), putting both files (timestamp in filename) in ~/Scans/:

#!/bin/sh
if [ "x${SCANBD_ACTION}" = "xcopy" ]
then
  STEM="/home/claude/Scans/$(date --iso=s | tr ":" "-")"
  scanimage -d "${SCANBD_DEVICE}" --mode Color --resolution 300 -x 210 -y 297 --format=pnm --output-file="${STEM}-300dpi.ppm"
  convert "${STEM}-300dpi.ppm" -colorspace RGB -posterize 2 -resize "33.333333333333333%" -density 100x100 -colorspace sRGB "${STEM}-100dpi.png"
else
  env
fi

/etc/scanbd/scripts/copy.script is a symlink to the test.script.

SCANBD_ACTION will be one of (left to right on scanner):

  • copy
  • scan
  • file
  • email

The Scans folder has write permissions for the scanner group, set with chown claude:scanner:

$ ls -lad /home/claude/Scans
drwxrwxr-x 2 claude scanner 4096 Nov 19 13:29 /home/claude/Scans

# 2 Moving Image

# 2.1 EasyCAP

USB 2.0 Video Adaptor with Audio

  • bulky USB stick with LED and cables

  • inputs

    • S-video (black DIN socket), untested

    • composite video (yellow RCA socket), works with SCART-to-composite cable from VCR

    • stereo audio (red and white RCA sockets), integrated audio interface is noisy and suffers from xruns, so I use my Edirol UA-25 instead

    • provided USB extension cable makes it stop working properly, plugged directly into port of powered USB hub works fine

  • video formats

    • 720x576i50 PAL (bottom field first)

    • 720x480i60 NTSC (advertised, untested)

  • bundled software CD for Windows 2000, Windows XP, Windows 7, Windows Vista, requiring at least Pentium III 800 with 4GB HDD and 256MB RAM.

  • works fine on Debian Linux with built in usbtv driver, gives /dev/video0 or similar

    • configure with mplayer
mplayer tv:// -tv driver=v4l2:norm=PAL:width=720:height=576:outfmt=uyvy:device=/dev/video0:input=0:fps=25:buffersize=256:alsa:amode=1:forcechan=2:audiorate=48000:adevice=default:forceaudio:immediatemode=0 -mc 0 -ao alsa:device=hw=4,0
  • check with ffplay
ffplay /dev/video0 -vf bwdif=parity=bff
  • record with ffmpeg (use meterbridge to check audio level, use qpwgraph to connect ffmpeg to correct soundcard)
ffmpeg -f alsa -thread_queue_size 64 -ac 2 -ar 48000 -i default -f video4linux2 -thread_queue_size 64 -i /dev/video0 -vf bwdif=parity=bff -pix_fmt yuv420p -profile:v high -level:v 4.1 -crf:v 16 -bf:v 2 -g:v 15 -codec:a copy "$(date --iso=s | tr ':' '-').mkv"

# 3 Sound

# 3.1 Edirol UA-25

24it 96kHz USB Audio Capture

  • formats

    • 44100 Hz duplex

    • 48000 Hz duplex

    • 96000 Hz with toggle on rear to select input or output (not duplex)

  • inputs

    • two balanced(?) 1/4“ TRS + XLR combo sockets on front, with individual volume controls

    • input limiter activated by switch on rear, LED shows peak / activation

    • phantom power activated by switch on rear, untested

    • right input Hi-Z toggle on front (impedance?), untested

    • digital input on rear, untested

    • direct monitoring of input with level control and toggle, and mono monitor toggle, controls on front

    • MIDI input DIN on rear

  • outputs

    • stereo 1/4“ TRS headphone socket

    • two balanced 1/4“ TRS sockets on rear

    • two unbalanced RCA sockets on rear

    • digital output on rear, untested

    • MIDI output DIN

  • works fine on Debian Linux, no special driver needed