From 94c9bd918a883172ce53663d37fc342a06ebfcd5 Mon Sep 17 00:00:00 2001 From: Prince Date: Tue, 27 Jan 2026 12:13:39 +0530 Subject: [PATCH 1/5] Document existing --timestamp-map option for WebVTT output --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 9a18f102..6662f7f7 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,22 @@ The core functionality is written in C. Other languages used include C++ and Pyt Downloads for precompiled binaries and source code can be found [on our website](https://ccextractor.org/public/general/downloads/). +### WebVTT Output Options + +CCExtractor supports optional WebVTT-specific headers for advanced use cases +such as HTTP Live Streaming (HLS). + +#### `--timestamp-map` + +Enable writing the `X-TIMESTAMP-MAP` header in WebVTT output. + +This header is required for HLS workflows but is **disabled by default** +to preserve compatibility with standard WebVTT players. + +Example: +```bash +ccextractor input.ts --timestamp-map -o output.vtt + ### Windows Package Managers From 7cd7504e72d220ffdd847c2b9854c0cde57a3534 Mon Sep 17 00:00:00 2001 From: Prince Date: Mon, 2 Feb 2026 14:19:03 +0530 Subject: [PATCH 2/5] Fix unclosed code block in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6662f7f7..b365d8ea 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ to preserve compatibility with standard WebVTT players. Example: ```bash ccextractor input.ts --timestamp-map -o output.vtt - +``` ### Windows Package Managers @@ -132,4 +132,4 @@ For more information visit the CCExtractor website: [https://www.ccextractor.org ## License -GNU General Public License version 2.0 (GPL-2.0) +GNU General Public License version 2.0 (GPL-2.0) \ No newline at end of file From 2ac017f8fe7f39947c96f5386f80beba1c589074 Mon Sep 17 00:00:00 2001 From: Ahmed Alian Date: Mon, 9 Feb 2026 20:03:10 +0200 Subject: [PATCH 3/5] feat(transcript): Implement dictionary-based capitalization and censorship --- docs/CHANGES.TXT | 1 + src/lib_ccx/ccx_encoders_transcript.c | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index 053b01d2..efd77343 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -1,6 +1,7 @@ 0.96.6 (unreleased) ------------------- - New: Add Snap packaging support with Snapcraft configuration and GitHub Actions CI workflow. +- New: Implement dictionary-based capitalization and censorship for transcripts - Fix: Clear status line output on Linux/WSL to prevent text artifacts (#2017) - Fix: Prevent infinite loop on truncated MKV files - Fix: Various memory safety and stability fixes in demuxers (MP4, PS, MKV, DVB) diff --git a/src/lib_ccx/ccx_encoders_transcript.c b/src/lib_ccx/ccx_encoders_transcript.c index 55e227e8..81f1dc94 100644 --- a/src/lib_ccx/ccx_encoders_transcript.c +++ b/src/lib_ccx/ccx_encoders_transcript.c @@ -120,11 +120,8 @@ int write_cc_subtitle_as_transcript(struct cc_subtitle *sub, struct encoder_ctx start_time = sub->start_time; end_time = sub->end_time; } - if (context->sentence_cap) - { - // TODO capitalize (context, line_number,data); - // TODO correct_case_with_dictionary(line_number, data); - } + if (sub->data) + correct_spelling_and_censor_words(context, (unsigned char *)sub->data, strlen((char *)sub->data)); if (start_time == -1) { From 9710e8163c371a4906d6f8cd3d50cf09015c2b61 Mon Sep 17 00:00:00 2001 From: ishaan-arora-1 Date: Sat, 14 Feb 2026 05:35:41 +0530 Subject: [PATCH 4/5] fix(matroska): use correct strlen for end timestamp in subtitle output In save_sub_track(), the length argument for writing timestamp_end was incorrectly using strlen(timestamp_start) instead of strlen(timestamp_end). This affected WebVTT, SRT, and ASS/SSA output paths for Matroska subtitle extraction. --- docs/CHANGES.TXT | 1 + src/lib_ccx/matroska.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index 33217c66..69222f42 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -1,5 +1,6 @@ 0.96.6 (unreleased) ------------------- +- Fix: Incorrect strlen argument when writing end timestamps in MKV subtitle extraction (WebVTT, SRT, ASS/SSA) - Fix: DVB EIT start time BCD decoding in XMLTV output causing invalid timestamps (#1835) - New: Add Snap packaging support with Snapcraft configuration and GitHub Actions CI workflow. - Fix: Clear status line output on Linux/WSL to prevent text artifacts (#2017) diff --git a/src/lib_ccx/matroska.c b/src/lib_ccx/matroska.c index 95a8e050..bebd2757 100644 --- a/src/lib_ccx/matroska.c +++ b/src/lib_ccx/matroska.c @@ -1795,7 +1795,7 @@ void save_sub_track(struct matroska_ctx *mkv_ctx, struct matroska_sub_track *tra write_wrapped(desc, timestamp_start, strlen(timestamp_start)); write_wrapped(desc, " --> ", 5); - write_wrapped(desc, timestamp_end, strlen(timestamp_start)); + write_wrapped(desc, timestamp_end, strlen(timestamp_end)); // writing cue settings list if (blockaddition != NULL) @@ -1836,7 +1836,7 @@ void save_sub_track(struct matroska_ctx *mkv_ctx, struct matroska_sub_track *tra write_wrapped(desc, "\n", 1); write_wrapped(desc, timestamp_start, strlen(timestamp_start)); write_wrapped(desc, " --> ", 5); - write_wrapped(desc, timestamp_end, strlen(timestamp_start)); + write_wrapped(desc, timestamp_end, strlen(timestamp_end)); write_wrapped(desc, "\n", 1); int size = 0; while (*(sentence->text + size) == '\n' || *(sentence->text + size) == '\r') @@ -1866,7 +1866,7 @@ void save_sub_track(struct matroska_ctx *mkv_ctx, struct matroska_sub_track *tra write_wrapped(desc, "Dialogue: Marked=0,", strlen("Dialogue: Marked=0,")); write_wrapped(desc, timestamp_start, strlen(timestamp_start)); write_wrapped(desc, ",", 1); - write_wrapped(desc, timestamp_end, strlen(timestamp_start)); + write_wrapped(desc, timestamp_end, strlen(timestamp_end)); write_wrapped(desc, ",", 1); char *text = ass_ssa_sentence_erase_read_order(sentence->text); char *text_to_free = text; // Save original pointer for freeing From 1afd909e8a910e363f5ec03cf0ae4a37f19021d9 Mon Sep 17 00:00:00 2001 From: ishaan-arora-1 Date: Sat, 14 Feb 2026 05:42:55 +0530 Subject: [PATCH 5/5] fix(matroska): add missing open() check and close() in save_sub_track MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit save_sub_track() was missing two things: 1. No check on the return value of open(). If open() failed, desc would be -1, and the subsequent write_wrapped() calls would trigger a fatal error with a confusing message. 2. The file descriptor was never closed at the end of the function, leaking it on every call. The neighboring save_vobsub_track() already handles both correctly — this brings save_sub_track() in line with it. --- docs/CHANGES.TXT | 1 + src/lib_ccx/matroska.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index 33217c66..dcb52385 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -1,5 +1,6 @@ 0.96.6 (unreleased) ------------------- +- Fix: File descriptor leak and missing open() error check in MKV subtitle track saving - Fix: DVB EIT start time BCD decoding in XMLTV output causing invalid timestamps (#1835) - New: Add Snap packaging support with Snapcraft configuration and GitHub Actions CI workflow. - Fix: Clear status line output on Linux/WSL to prevent text artifacts (#2017) diff --git a/src/lib_ccx/matroska.c b/src/lib_ccx/matroska.c index 95a8e050..2d073eff 100644 --- a/src/lib_ccx/matroska.c +++ b/src/lib_ccx/matroska.c @@ -1742,6 +1742,12 @@ void save_sub_track(struct matroska_ctx *mkv_ctx, struct matroska_sub_track *tra free(filename); } + if (desc < 0) + { + mprint("\nError: Cannot create output file for subtitle track\n"); + return; + } + if (track->header != NULL) write_wrapped(desc, track->header, strlen(track->header)); @@ -1880,6 +1886,9 @@ void save_sub_track(struct matroska_ctx *mkv_ctx, struct matroska_sub_track *tra free(timestamp_end); } } + + if (desc != 1) + close(desc); } void free_sub_track(struct matroska_sub_track *track)