# KB OCR Processor Skill **kb-ocr-processor** - Extract text from video frames using OCR. ## Features - **视频截帧**: 直接从视频文件截取帧图片 - **批量处理**: 支持处理帧目录 - **双引擎**: EasyOCR / Tesseract - **置信度评分**: 每帧识别结果带置信度 - **文本合并**: 自动合并所有帧的识别结果 ## Commands ```bash # 方式1: 直接从视频截帧并OCR(推荐) python ocr_processor.py --video ./video.flv --output ocr.json # 方式2: 处理已截取的帧目录 python ocr_processor.py --input ./frames/ --output ocr.json # 指定截帧帧率(默认1帧/秒) python ocr_processor.py --video ./video.flv --fps 2 --output ocr.json # 同时生成合并的文本文件 python ocr_processor.py --video ./video.flv --output ocr.json --merge # 使用 Tesseract 引擎 python ocr_processor.py --input ./frames/ --engine tesseract --output ocr.json ``` ## Workflow 中的使用 ```bash # 步骤5: OCR处理(视频无字幕时) python ocr_processor.py --video ${CONTENT_VIDEO_PATH} --output ${CONTENT_DIR}/ocr.json --merge ``` ## Output ```json { "success": true, "engine": "easyocr", "total_frames": 619, "results": [ { "source": "0001.jpg", "text": "字幕文字", "confidence": 0.95 } ] } ``` ## Installation ```bash cp -r kb-ocr-processor/ ~/skills/ pip install -r requirements.txt # 依赖说明 # - easyocr: 主要OCR引擎(自动下载模型) # - pytesseract: Tesseract引擎 # - ffmpeg: 视频截帧(apt install ffmpeg) ```