Commit Graph

20 Commits

Author SHA1 Message Date
Dhanush
395f9b3213 fix: MKV subtitle track .(null) extension for KATE and unknown codec IDs (#2250)
* fix: MKV subtitle track .(null) extension for KATE and unknown codec IDs

The matroska_track_text_subtitle_id_extensions array had 7 entries for
an 8-value enum, leaving MATROSKA_TRACK_SUBTITLE_CODEC_ID_KATE (index 7)
out of bounds. On most platforms this read NULL, which then caused
strlen(NULL) UB and snprintf to emit .(null) in the output filename.

Two fixes:
- Add "kate" at index 7 in the extensions array so KATE tracks
  produce correct .kate output filenames
- Add a NULL guard in generate_filename_from_track() so any future
  unknown codec ID safely falls back to .bin instead of crashing or
  producing .(null)

Fixes #972

* fix: MKV subtitle track .(null) extension for KATE and unknown codec IDs

The matroska_track_text_subtitle_id_extensions array had 7 entries for
an 8-value enum, leaving MATROSKA_TRACK_SUBTITLE_CODEC_ID_KATE (index 7)
out of bounds. On most platforms this read NULL, which then caused
strlen(NULL) UB and snprintf to emit .(null) in the output filename.

Two fixes:
- Add "kate" at index 7 in the extensions array so KATE tracks
  produce correct .kate output filenames
- Add a NULL guard in generate_filename_from_track() so any future
  unknown codec ID safely falls back to .bin instead of crashing or
  producing .(null)

Fixes #972

* fix: MKV subtitle track .(null) extension for KATE and unknown codec IDs

The matroska_track_text_subtitle_id_extensions array had 7 entries for
an 8-value enum, leaving MATROSKA_TRACK_SUBTITLE_CODEC_ID_KATE (index 7)
out of bounds. On most platforms this read NULL, which then caused
strlen(NULL) UB and snprintf to emit .(null) in the output filename.

Two fixes:
- Add "kate" at index 7 in the extensions array so KATE tracks
  produce correct .kate output filenames
- Add a NULL guard in generate_filename_from_track() so any future
  unknown codec ID safely falls back to .bin instead of crashing or
  producing .(null)

Fixes #972

---------

Co-authored-by: Dhanush Varma <your@email.com>
2026-04-04 14:28:48 -07:00
Varadraj75
934398fc86 feat: support V_MPEG2 tracks in MKV demuxer for CC extraction
MKV files with MPEG-2 video (common in DVD sources) were silently skipped.
Add V_MPEG2 track detection and processing using the existing process_m2v()
infrastructure, matching how mp4.c handles MPEG-2 streams.

Fixes #2149
2026-02-28 21:43:42 +05:30
Carlos Fernandez
1fccb783f2 feat(matroska): Add VOBSUB subtitle extraction support for MKV files
Previously, CCExtractor would only print "Error: VOBSUB not supported"
when encountering VOBSUB (S_VOBSUB) subtitle tracks in Matroska files.
This left users without any usable output.

This commit adds full VOBSUB extraction support:
- Generate proper .idx index files with timestamps and file positions
- Generate proper .sub files with PS-wrapped SPU data
- Correct PS Pack header with SCR derived from timestamps
- Correct PES header with PTS for each subtitle
- 2048-byte block alignment (standard VOBSUB format)

The output is compatible with VLC, FFmpeg, and other players that
support VobSub subtitle format.

Tested with sample from issue #1371 - output validates correctly
with FFprobe and produces identical subtitle data to mkvextract.

Fixes #1371

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 10:02:19 +01:00
Carlos Fernandez
44363c0acd fix(mkv): Add HEVC/H.265 caption extraction for Matroska containers
Extends HEVC caption extraction support to MKV files.

Changes to matroska.h:
- Add hevc_codec_id constant for V_MPEGH/ISO/HEVC
- Add hevc_track_number field to matroska_ctx structure
- Add process_hevc_frame_mkv() function declaration

Changes to matroska.c:
- Detect HEVC tracks in parse_segment_track_entry()
- Modify parse_simple_block() to route HEVC tracks to HEVC processor
- Add process_hevc_frame_mkv() with is_hevc flag and store_hdcc() call
- Parse HEVCDecoderConfigurationRecord in parse_private_codec_data()
- Initialize hevc_track_number in matroska_loop()
- Update output messages to report HEVC tracks

Tested with HEVC MKV file - extracts 73 captions matching MP4 output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 05:59:23 +01:00
Carlos Fernandez Sanz
8d95ad0e7b chore: Apply code formatting and update changelog (#1825)
- Apply clang-format to all C/H files in src/
- Apply cargo fmt to Rust code
- Update Cargo.lock with latest compatible dependency versions
- Add 24 new entries to CHANGES.TXT for recent fixes and features

Changes in CHANGES.TXT cover:
- CEA-708 bounds checks and UTF-16BE encoding fixes
- New --ttxtforcelatin option for Teletext
- TS files without PAT/PMT fallback support
- Timing accuracy improvements across MP4/MPEG/TS
- Memory safety improvements (null checks, buffer overruns)
- Multi-file processing fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 13:34:16 -08:00
tank0nf
b62027a0ae [FIX] Issue#1665 Enhanced Matroska Language Tag Handling (#1671)
* fix unknown element for IETF tag

* added documentation changes

* added formatting for clang-format
2025-03-23 00:12:23 -07:00
Punit Lodha
0bd213e789 Fix file extension for IDX files (#1444)
* Fix file extension

* Vobsub not supported

* Fix formatting

* More formatting

Co-authored-by: Punit Lodha <punitlodha@pm.com>
2022-07-09 19:04:01 +05:30
Nils ANDRÉ-CHANG
66d59e498b Make -ocrlang work (#1200) 2020-01-19 11:44:16 -08:00
Artem Fedoskin
718cf55131 [FEATURE] Added support for DVB inside MKV (#1082)
* [FIX] Fix incorrect comparison of strings for AVC codec id in .mkv

* Initial work on adding DVB support to .mkv

* [REQUEST] Finished adding support for DVB inside MKV (#1000)

* Update CHANGES.TXT
2019-03-23 08:27:34 -07:00
Artyom Fedoskin
4d24568a0b [FEATURE] Added support for EIA-608 inside MKV (#1080)
* Initial work on adding EIA-608 support to Matroska

* [REQUEST] Finished adding support for EIA-608 inside MKV (#1068)
2019-03-15 17:30:48 -07:00
LucasYoung
dd5c1ee243 Added WebVTT output from Matroska 2017-03-30 00:09:40 -07:00
Diptanshu8
7212d6848a Refactoring 2017-03-16 15:58:38 +05:30
Diptanshu8
d08cad3642 Rebasing 2017-03-15 00:35:17 +05:30
Diptanshu8
7feb705d73 Rebasing 2017-03-15 00:33:12 +05:30
Evgeny Shulgin
f057a7db05 Added multiplatform LLD and LLU specs 2017-03-06 16:48:54 +03:00
Evgeny
a66f3c3973 Added "No captions" code support in Matroska 2017-03-02 16:46:10 +03:00
Evgeny Shulgin
2048827c45 Added time for the activity progress 2017-03-02 15:49:22 +03:00
Evgeny Shulgin
1f478cfb22 Added matroska warnings about "-out=" 2017-03-02 15:43:02 +03:00
Evgeny Shulgin
e74074ffd0 Removed matroska int and byte types 2017-03-02 14:44:43 +03:00
Evgeny Shulgin
20b557ff97 Matroska main part integrated 2017-03-01 21:50:20 +03:00