Automating Invoice Data Extraction with PipeWire and Tesseract on My Home Server
说明与用途
使用 PipeWire、ffmpeg、Tesseract 和 Node.js 在家庭服务器上自动从屏幕截图中提取发票数据。
问题
Digitize vendor invoice screenshots into searchable data without expensive software.
结果
Invoices are automatically captured, OCRed, and stored, eliminating manual transcription.
工作流
- 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
证据
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.
- 记录日期: 2026-11-02T14:14:09.869Z