Skip to content

Linux OCR library #12

Open
Open

Description

@yajrendrag

@niksedk - regarding your comment here (SubtitleEdit/subtitleedit#3568 (comment)) that OCR library that SE uses is windows only but it could be replaced... is it possible to replace via a command line option from linux, or would i have to do that in C and rebuild the source? i'm trying to use subtitleedit-cli from command line in linux & tesseract is installed on my machiune...

Activity

  1. niksedk commented on Mar 22, 2025

    @niksedk
    Member

    I've added nOCR of BDSup to the command line version (as you saw in the post)
    What are you trying to OCR?

    It should be easier now to add Tesseract, as image handling are now somewhat updated to dot net 8 (from System.Drawing to Skia).
    Depending on which subtitle format you're OCR'ing...

  2. yajrendrag commented on Mar 22, 2025

    @yajrendrag
    Author

    yes, i saw that. i'm looking to OCR hdmv_pgs_subtitle to srt. it completes without error, but has a lot of what i presume are OCR errors. I also tried in the full version with mono and it works without error. i just have a small sample file that i'm working from with a few lines.. but ultimately, i'd like to build it into a plugin for unmanic.

  3. niksedk commented on Mar 22, 2025

    @niksedk
    Member

    from .sup files?

  4. yajrendrag commented on Mar 22, 2025

    @yajrendrag
    Author

    yes, i extracted the subtitle track to a .sup file

  5. 9SMTM6 commented on Aug 3, 2025

    @9SMTM6

    @niksedk I am currently looking into this.

    having a CLI tool vastly eases ones ability to make this stuff convert whole libraries, and eases portability, as you highlighted.

    However, while I'm not entirely unfamiliar with C#, it isn't exactly my expertise, so I'll utilize LLM support to (try to, this will be my first shot at using these tools like that) make it work. Of course I won't submit stuff I don't understand (to a basic level) and the basic strategy will be coming from me.

    I'll likely give this a shot whether you'd accept such code or not, however should I come across larger blockers, it might become be relevant whether you'd willing to merge such an effort at all.

    Now some additional questions that might inform my approach.

    1. My understanding is that libse is going to be largely shared code between this CLI and the GUI
    2. However there seem to be some differences, one of them being that you appear to be using SkiaSharp even in the libse of this cli, while you don't currently do so in the GUI one (likely to make it work on other OSs at all?)
    3. your current approach with tessaract seems to be to export temporary png files and process these with tessaract via CLI commands. Unless you've got different ideas I'll try to keep that approach.
    4. this contains the current (tessaract specific) code for tessaract OCR in the GUI: src/ui/Logic/Ocr/Tesseract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions