Automating Invoice Data Extraction with PipeWire and Tesseract on My Home Server
Description and use
Automating invoice data extraction from screenshots using PipeWire, ffmpeg, Tesseract, and Node.js on a home server.
Problem
Digitize vendor invoice screenshots into searchable data without expensive software.
Outcome
Invoices are automatically captured, OCRed, and stored, eliminating manual transcription.
Workflow
- Install Ubuntu 22.04 LTS on home server
- Ensure PipeWire and pipewire-tools are installed
- Install Tesseract 5 and language data
- Install Node.js 20 and MySQL 8
- Use pw-record with ffmpeg to capture a 800×600 region at (100,200) for 1 second and output a single PNG
- Create Node.js module ocr.js that spawns pw-record and ffmpeg, collects PNG buffer
- Spawn tesseract via child_process, pipe PNG buffer to stdin, capture OCR output
- Insert OCR text into MySQL table for admin panel use
Evidence
PipeWire replaces the old X11 xwd workflow and works under Wayland out of the box.
The command above produces a series of PNG frames on stdout. For my use‑case I only need the first frame, so I add -vframes 1:
I keep the OCR step in a separate Node.js module so I can call it from my API or a cron job.
- Record date: 2026-11-02T14:14:09.869Z