[PR #1744] [IMPROVEMENT]: Ensure WebVTT output includes minimal X-TIMESTAMP-MAP for HLS compatibility #2466

Open
opened 2026-01-29 17:22:18 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1744
Author: @AbHash-RixE
Created: 9/3/2025
Status: 🔄 Open

Base: masterHead: issue-#1743-add-default-xtimestamp-map


📝 Commits (1)

  • 911b2b8 feat: add default X-TIMESTAMP-MAP header for empty subtitle files in WebVTT for HLS compatibility

📊 Changes

5 files changed (+78 additions, -1 deletions)

View changed files

📝 docs/CHANGES.TXT (+1 -0)
📝 src/ccextractor.c (+29 -1)
📝 src/lib_ccx/ccx_common_option.h (+11 -0)
📝 src/lib_ccx/ccx_encoders_helpers.c (+35 -0)
📝 src/lib_ccx/ccx_encoders_helpers.h (+2 -0)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

SUMMARY

This PR ensures that when --timestamp-map & --out=webvtt is used and no captions are detected, CCExtractor still writes a minimal header containing : X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000
This makes the generated .vtt file valid for HLS players, which often require this header even in empty subtitle files.

IMPLEMENTATION DETAILS

  1. CHANGES.TXT

-Added entry under Unreleased: 1.0
IMPROVEMENT: Add default X-TIMESTAMP-MAP header for empty subtitle files in WebVTT for better compatibility
of HLS streaming (#1743)

  1. src/ccextractor.c

-Call webvtt_write_minimal_header() in start_ccx() when no captions are found and --out=webvtt is set.

  1. src/lib_ccx/ccx_encoders_helpers.c

-Added new helper function webvtt_write_minimal_header()
-Which:
Initializes encoder context for WebVTT.
Writes a default X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000 line.
Ensures line terminator respects user config (LF vs CRLF).
Cleans up encoder context properly.

  1. src/lib_ccx/ccx_encoders_helpers.h

-Declared the new function: void webvtt_write_minimal_header(void);


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1744 **Author:** [@AbHash-RixE](https://github.com/AbHash-RixE) **Created:** 9/3/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `issue-#1743-add-default-xtimestamp-map` --- ### 📝 Commits (1) - [`911b2b8`](https://github.com/CCExtractor/ccextractor/commit/911b2b8ded2e1d147fe32b800ae96885829c1525) feat: add default X-TIMESTAMP-MAP header for empty subtitle files in WebVTT for HLS compatibility ### 📊 Changes **5 files changed** (+78 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/ccextractor.c` (+29 -1) 📝 `src/lib_ccx/ccx_common_option.h` (+11 -0) 📝 `src/lib_ccx/ccx_encoders_helpers.c` (+35 -0) 📝 `src/lib_ccx/ccx_encoders_helpers.h` (+2 -0) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [X] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [X] I have checked that another pull request for this purpose does not exist. - [X] I have considered, and confirmed that this submission will be valuable to others. - [X] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [X] I give this submission freely, and claim no ownership to its content. - [X] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [x] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. **SUMMARY** This PR ensures that when `--timestamp-map` & `--out=webvtt` is used and no captions are detected, CCExtractor still writes a minimal header containing : `X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000` This makes the generated .vtt file valid for HLS players, which often require this header even in empty subtitle files. **IMPLEMENTATION DETAILS** 1. `CHANGES.TXT` -Added entry under Unreleased: 1.0 IMPROVEMENT: Add default X-TIMESTAMP-MAP header for empty subtitle files in WebVTT for better compatibility of HLS streaming (#1743) 2. `src/ccextractor.c` -Call `webvtt_write_minimal_header()` in `start_ccx()` when no captions are found and `--out=webvtt` is set. 3. `src/lib_ccx/ccx_encoders_helpers.c` -Added new helper function `webvtt_write_minimal_header()` -Which: Initializes encoder context for WebVTT. Writes a default `X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000` line. Ensures line terminator respects user config (LF vs CRLF). Cleans up encoder context properly. 4. `src/lib_ccx/ccx_encoders_helpers.h` -Declared the new function: `void webvtt_write_minimal_header(void);` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:22:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2466