* fix(dvb): Multiple fixes for DVB subtitle extraction from Chinese broadcasts (#224) This commit addresses multiple issues with DVB subtitle extraction reported in #224: 1. **PMT parsing crash fix** (ts_tables.c): - Added minimum length check (16 bytes) to prevent out-of-bounds access - Added bounds check before memcpy to prevent buffer overflow when section > 1021 bytes 2. **Negative subtitle timing fix** (general_loop.c): - For DVB subtitle streams, properly initialize min_pts from audio/subtitle PTS - This fixes the issue where all timestamps were negative (~95000 seconds off) 3. **OCR improvements** (ocr.c): - Fixed ignore_alpha_at_edge() which could create invalid crop windows - Added image inversion for DVB subtitles (light text on dark background) to improve Tesseract OCR accuracy - Added contrast normalization to further improve character recognition - Fixed nofontcolor check to respect --no-fontcolor parameter - Added iteration safety limit in color detection loop 4. **--ocrlang parameter fix** (Rust files): - Changed ocrlang from Language enum to String to accept Tesseract language names directly (e.g., "chi_tra", "chi_sim", "eng") - Added case-insensitive matching for --dvblang parameter - Added better error messages for invalid language codes Tested with 12GB Chinese DVB broadcast file: - Timing: All timestamps now positive (0.235s, 2.594s, etc.) - OCR: ~80-90% accuracy with chi_tra traineddata (improved from ~70%) - No crashes during full file processing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ocr): Fix crashes in DVB subtitle color detection Two issues fixed in the OCR color detection code: 1. Tesseract crash during iteration: - The color detection pass used raw color images without preprocessing - Tesseract expects dark text on light background, but DVB subtitles have light text on dark background - Added grayscale conversion, inversion, and contrast enhancement (same preprocessing as the main OCR pass) 2. Heap corruption in histogram calculation: - The histogram loop had no bounds checking on array accesses - Tesseract could return invalid bounding boxes causing buffer overflows - Added validation of bounding box coordinates before processing - Added safe index checking for copy->data and histogram arrays Also added skip_color_detection label for clean error handling and proper cleanup of the preprocessed image. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(dvb): Fix zero-duration subtitles and overlaps during PTS jumps Add start_pts field to cc_subtitle struct to track raw PTS values independent of FTS timeline resets. Modify end_time calculation in dvbsub_handle_display_segment() to cap duration at 4 seconds when PTS jumps cause timeline discontinuities, preventing zero-duration and overlapping subtitles. Also update .gitignore to exclude plans/ directory and temp files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CCExtractor
check AUTHORS.TXT for history and developers
License
GPL 2.0.
Description
Since the original port, the whole code has been rewritten (more than once, one might add) and support for most subtitle formats around the world has been added (teletext, DVB, CEA-708, ISDB...)
Basic Usage
(please run ccextractor with no parameters for the complete manual - this is for your convenience, really).
ccextractor reads a video stream looking for closed captions (subtitles). It can do two things:
- Save the data to a "raw", unprocessed file which you can later use as input for other tools, such as McPoodle's excellent suite.
- Generate a subtitles file (.srt,.smi, or .txt) which you can directly use with your favourite player.
Running ccextractor without parameters shows the help screen. Usage is trivial - you just need to pass the input file and (optionally) some details about the input and output files.
Languages
Usually English captions are transmitted in line 21 field 1 data, using channel 1, so the default values are correct so you don't need to do anything and you don't need to understand what it all means.
If you want the Spanish captions, you may need to play a bit with the parameters. From what I've been, Spanish captions are usually sent in field 2, and sometimes in channel 2.
So try adding these parameter combinations to your other parameters.
-2 -cc2 -2 -cc2
If there are Spanish subtitles, one of them should work.
McPoodle's page
http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_TOOLS.HTML
Essential CC related information and free (with source) tools.
Encoding
This version, in both its Linux and Windows builds generates by default Unicode files. You can use -latin1 and -utf8 if you prefer these encodings (usually it just depends on what your specific player likes).
Future work
- Please check www.ccextractor.org for news and future work.