This project extracts timestamp overlays from multi-camera MP4 videos using OCR, repairs and smooths noisy timestamps, exports every frame with a corrected filename timestamp, and finally reconstructs fully synchronised videos (per-camera + a 2×2 grid montage).
The tool is built as a command-line application using Typer, performs OCR using Tesseract, processes frames with OpenCV, and uses FFmpeg to encode output videos.
-
Automatic OCR extraction of timestamp overlays from each video frame
-
Robust cleaning and repair of noisy OCR output
-
Intelligent timestamp smoothing to correct glitches and dropped frames
-
Parallel video processing using ProcessPoolExecutor
-
Frame export with consistent, timestamp-based filenames
-
Automatic detection of synchronisable timestamps across cameras
-
Per-camera MP4 reconstruction using FFmpeg
-
2×2 synchronised grid video
-
Configurable input folders and parallel workers
- Clone the repository
git clone <your-repo-url>
cd <your-project>- Create a virtual environment
python -m venv .venv
.\.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS/Linux- Install Python dependencies
pip install -r requirements.txtThe tool requires several external binaries:
Used for video encoding and stitching. Download: https://ffmpeg.org/download.html
Check installation:
ffmpeg -versionUsed to read timestamps from frames. Download: https://tesseract-ocr.github.io/tessdoc/
Windows default expected path:
C:\Program Files\Tesseract-OCR\tesseract.exe
Check installation:
tesseract --versionThe main entry point is main.py, which automatically:
C:/sync/24/2025Sep12/videos C:/sync/25/2025Sep12/videos C:/sync/26/2025Sep12/videos C:/sync/27/2025Sep12/videos
Extracts and cleans OCR timestamps
Saves frames into frames/ folders
Runs the synchronisation + FFmpeg reconstruction
Per-camera MP4 videos
A synced grid video
Basic command
python main.py runCustom directories
python main.py run --video-dirs "C:/data/camA" "C:/data/camB"Change worker count
python main.py run --max-workers 6Output
After running, the output will appear under:
C:/sync/output_videos/
This will include:
24.mp4 # camera 24
25.mp4 # camera 25
26.mp4 # camera 26
27.mp4 # camera 27
sync_grid.mp4 # montage.
├── main.py # Main Typer application (OCR, frame extraction)
├── process_frames.py # Synchronisation + FFmpeg encoding
├── requirements.txt # Python dependencies
└── README.md # Project documentation