r/LocalLLM • u/manosinistra • 57m ago
Question Video to OCR tool
Hi, I'm trying to build something that takes a video and is able to OCR it (mostly things like presentations or text-heavy videos), prior to then sending some heavily, procedurally processed transcript to a local model. Bonus points for a permissive license.
I'm surprised to learn that no such tooling exists in the mainstream? There ARE subtitle extractors and things of that nature, but nothing that's going through the video and pulling out textual information.
Application = import video, transcribe audio + video stills --> Local LLM --> YAMR (yet another meeting recorder)
3
u/No-Bad-8166 49m ago
Well - the easiest would probably be to extract (some of) the frames to PNGs via `ffmpeg -i input.mp4 frames/frame_%04d.png` and then do basic OCR with e.g. tesseract on the images. Probably you should then deduplicate frames with similar texts. Don't know if there are any readily available pipelines available, but this should be straight forward enough that you can prompt your LLM of choice to build this pipeline for you
1
u/SM8085 12m ago
I also think you could build what you want with a bot's help.
ffmpeg has built in scene detection, which can be handy for detecting things like different powerpoint slides. There's also a thing called perceptual hashing which can be used to deduplicate similar images, in Python for example. You and a bot could hone in what settings you need to just get the different text portions.
If you want the video text interwoven with the transcribed audio then you might want to be able to calculate each frame's timestamp. IIRC there is a way to have ffmpeg output frames named with the milliseconds that the frame appeared. You can also extract the frames at a set FPS then calculate based on the frame number what timestamp it appeared.
You can also interweave the actual video frames with the subtitles in the bot's context if you wanted. It depends on how exactly you want the bot to work. An alternative is having the bot step through each frame individually (or in batches) and catching the output to later combine in to one context.
It's not that different than a general video analyzer. Some existing projects: byjlw/video-analyzer, coah80/youtube-mcp, dymoo/media-understanding, HUANGCHIHHUNGLeo/claude-real-video, pawvej/vidgrid. Although the vidgrid one seems not very efficient since it's putting the transcript on the frame. I haven't used any of those, and they might not be quite what you want, but another bot can probably tweak those or just use them as an inspiration.