VisioForge

On-device OCR for video streams in .NET

Recognize text in RTSP camera streams, webcams and video files from C#. OCR runs as a block of the Media Blocks SDK .NET pipeline — on the device, next to preview, recording and streaming.

Video OCR is not image OCR in a loop

An image OCR library takes one bitmap. To read text from a camera or a recording with it, you still decode the stream, pick frames, convert them, call the library and keep track of when each frame was shown. In VisioForge SDKs, OCR is a block of the video pipeline: the SDK decodes the source, OcrBlock reads the frames as they pass, and the same frames continue to the screen, a file or a network stream.

Image OCR library vs OCR in the video pipeline

Typical image OCR libraryOcrBlock in a VisioForge pipeline
InputA bitmap your code passes inDecoded frames from any SDK source: file, webcam, RTSP camera
Decoding the videoYour code, with a separate decoder or frame grabberDone by the pipeline
Which frames are readYou pick and convert themFramesToSkip; frames that arrive while OCR is busy are skipped and counted
When the text appearedYou track it yourselfTimestamp on every OnTextDetected event
Recording or streaming at the same timeA separate video pipelineThe same pipeline: OcrBlock output goes on to an encoder, a file or a stream
Boxes and text in the videoYou draw themDrawResults

What OCR inside the pipeline gives you

OcrBlock ships in the VisioForge.DotNet.Core.AI package. It has one video input and one video output and runs the PP-OCR models on the frames it receives.

  • Decoding is done for you: any source the SDK opens — video files, webcams, RTSP IP cameras — feeds OcrBlock directly
  • Text with time and place: each OnTextDetected event carries the frame Timestamp and, for every line, its Text, Confidence and BoundingBox
  • OCR next to recording and streaming: frames leave OcrBlock unchanged or with the text drawn in, and go on to an encoder, a file or a network output in the same pipeline
  • On the device: PP-OCR models on ONNX Runtime with the CPU, CUDA, DirectML or CoreML provider — no cloud API, no per-call fee, the video stays on the machine
  • 100+ languages: point RecognitionModelPath and CharacterDictionaryPath at the PP-OCR model and dictionary for your language; the samples ship the Latin model
  • Cross-platform: Windows, macOS, Linux, Android and iOS from one C# codebase; the OCR sample also exists for .NET MAUI
  • Cost under control on live video: FramesToSkip = N runs OCR on one frame in N + 1; every setting and its default is in the OCR guide

Where it is used

Searchable recordings

Extract the text of recorded lectures, webinars and screen recordings with the timestamp of each line, and index it.

Broadcast and signage monitoring

Check that lower thirds, tickers and digital signage show the expected text, on a live feed or a recording.

Production lines

Read serial numbers, batch codes and printed labels from a fixed camera while the same stream is recorded for traceability.

IP cameras in retail and warehouses

Read shelf tags and product labels from RTSP cameras on site, without sending video to a cloud OCR service.

Code Examples

Built from the OCR Text Recognition Demo; the recording branch wires the H.264 encoder and MP4 sink the way the Media Blocks samples do.

Extract the text of a video file with timestamps

C#

Read text from an RTSP camera and record it to MP4

C#

Pipeline

In the RTSP example OcrBlock sits between the camera and the encoder. Recognized text leaves through the OnTextDetected event; the frames go on to the H.264 encoder and the MP4 file.

RTSPSourceBlock
OcrBlock
H264EncoderBlock
MP4SinkBlock

Frequently Asked Questions

Does the video leave the machine?▼
No. OcrBlock runs the PP-OCR models with ONNX Runtime inside your process. There is no cloud service and no API key; frames and recognized text stay on the device. The models are files you ship with your application.
How is this different from an image OCR library?▼
An image OCR library expects you to decode the video, choose frames and call it per bitmap. OcrBlock is part of the pipeline that decodes the source: it receives decoded frames, skips them according to FramesToSkip, reports each region with the frame timestamp, and passes the frames on to rendering, encoding or streaming.
Can I recognize text and record the stream at the same time?▼
Yes. Connect the OcrBlock output to an encoder and a file sink, as in the RTSP example above. DrawResults decides whether the boxes and text are burned into the recording.
Which SDK do I need?▼
OcrBlock is in the VisioForge.DotNet.Core.AI package. Use it in a Media Blocks SDK .NET pipeline when you build the pipeline yourself, or add it with Video_Processing_AddBlock to VideoCaptureCoreX in Video Capture SDK .NET or to MediaPlayerCoreX in Media Player SDK .NET when your app is already built on one of those engines.
Can I ship the OCR models in a commercial product?▼
The SDK runs third-party ONNX models and does not include model weights in the NuGet package. The PP-OCRv5 mobile models that ship with the samples are Apache-2.0. A model's license comes from its origin, so check the license of any other model, its weights and its training data before you ship it.
Can I combine OCR with other AI blocks?▼
Yes. LicensePlateRecognizerBlock, YOLOObjectDetectorBlock and PIIRedactionBlock have the same video input and output as OcrBlock, so they connect one after another in the same pipeline. To hide on-screen text instead of reading it, PIIRedactionBlock blurs or pixelates text regions found with the PaddleOCR models.