-
Notifications
You must be signed in to change notification settings - Fork 512
feat(mp4): Add VOBSUB subtitle extraction with OCR for MP4 files #1920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+884
−7
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add support for extracting VOBSUB (bitmap) subtitles from MP4 files and converting them to text formats via OCR. This complements the existing MKV VOBSUB support added in commit 1fccb78. Changes: - Add shared vobsub_decoder module for SPU parsing and OCR - Add process_vobsub_track() function in mp4.c for subp:MPEG tracks - Detect and count VOBSUB tracks in MP4 container - Extract palette from decoder config when available - Process SPU samples through OCR pipeline The VOBSUB decoder module provides: - SPU control sequence parsing (timing, colors, coordinates) - RLE-encoded bitmap decoding (interlaced format) - Palette parsing from idx header format - Integration with Tesseract OCR via ocr_rect() Tested with sample from issue #1349 - successfully extracted 61 subtitles from 128 SPU samples with accurate OCR text output. Fixes #1349 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ocr_text field in struct cc_bitmap is only defined when ENABLE_OCR is set. Wrap the free() calls with #ifdef ENABLE_OCR to fix build failures in non-OCR configurations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add vobsub_decoder.c and vobsub_decoder.h to linux and mac Makefile.am to fix autoconf build failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add vobsub_decoder.c and vobsub_decoder.h to the Visual Studio project and filters files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 5beb438...:
Congratulations: Merging this PR would fix the following tests:
All tests passed completely. Check the result page for more info. |
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit ec30a79...:
Your PR breaks these cases:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
vobsub_decodermodule for SPU parsing and OCR integrationsubp:MPEGtracks in MP4 container and processes them through OCR pipelineChanges
New Files
src/lib_ccx/vobsub_decoder.c- VOBSUB decoder with SPU parsing and OCRsrc/lib_ccx/vobsub_decoder.h- Public API headerModified Files
src/lib_ccx/mp4.c- Add VOBSUB track detection and processingsrc/lib_ccx/matroska.c- Integrate shared VOBSUB decoder for MKV OCR supportFeatures
The VOBSUB decoder module provides:
ocr_rect()Test Results
Tested with sample from issue #1349:
Successfully extracted 61 subtitles with accurate OCR output:
Test plan
-DWITH_OCR=ON)Fixes #1349
🤖 Generated with Claude Code