[PR #1772] [FIX] Fix missing X-TIMESTAMP-MAP header in WebVTT when no subtitles found #2499

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1772
Author: @dRaniwal
Created: 11/26/2025
Status: 🔄 Open

Base: masterHead: fix-webvtt-timestamp-map-empty-subs


📝 Commits (1)

  • 4faa320 Fix missing X-TIMESTAMP-MAP header in WebVTT when no subtitles found

📊 Changes

4 files changed (+49 additions, -19 deletions)

View changed files

📝 src/lib_ccx/ccx_encoders_common.c (+4 -0)
📝 src/lib_ccx/ccx_encoders_common.h (+1 -0)
📝 src/lib_ccx/ccx_encoders_webvtt.c (+32 -19)
📝 src/lib_ccx/lib_ccx.c (+12 -0)

📄 Description

Problem

I noticed that when running CCExtractor with the --timestamp-map flag on a video file that has no subtitles, the resulting WebVTT file was just empty with only "WEBVTT" at the top. The X-TIMESTAMP-MAP header was completely missing, which breaks HLS streaming compatibility.

What I changed

  • Updated write_webvtt_header() so it can write to a specific output file
  • Added a fallback that writes a default timestamp map (X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000) when there's no timing info available
  • Made sure WebVTT files get their header written even when there are no subtitles by handling this in write_subtitle_file_footer()
  • Fixed a cleanup issue where encoders weren't being properly closed if no subtitles were found

Fixes #1743

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.

Testing

Ran CCExtractor on a .ts file with no subtitles using the --timestamp-map flag. Before this fix, the output was just "WEBVTT". Now it correctly outputs:


🔄 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/1772 **Author:** [@dRaniwal](https://github.com/dRaniwal) **Created:** 11/26/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix-webvtt-timestamp-map-empty-subs` --- ### 📝 Commits (1) - [`4faa320`](https://github.com/CCExtractor/ccextractor/commit/4faa320d4f22cd436591d4bf3d5f47d78cbe344a) Fix missing X-TIMESTAMP-MAP header in WebVTT when no subtitles found ### 📊 Changes **4 files changed** (+49 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_encoders_common.c` (+4 -0) 📝 `src/lib_ccx/ccx_encoders_common.h` (+1 -0) 📝 `src/lib_ccx/ccx_encoders_webvtt.c` (+32 -19) 📝 `src/lib_ccx/lib_ccx.c` (+12 -0) </details> ### 📄 Description ## Problem I noticed that when running CCExtractor with the `--timestamp-map` flag on a video file that has no subtitles, the resulting WebVTT file was just empty with only "WEBVTT" at the top. The `X-TIMESTAMP-MAP` header was completely missing, which breaks HLS streaming compatibility. ## What I changed - Updated `write_webvtt_header()` so it can write to a specific output file - Added a fallback that writes a default timestamp map (`X-TIMESTAMP-MAP=MPEGTS:0,LOCAL:00:00:00.000`) when there's no timing info available - Made sure WebVTT files get their header written even when there are no subtitles by handling this in `write_subtitle_file_footer()` - Fixed a cleanup issue where encoders weren't being properly closed if no subtitles were found Fixes #1743 **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. - [ ] **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. --- ## Testing Ran CCExtractor on a `.ts` file with no subtitles using the `--timestamp-map` flag. Before this fix, the output was just "WEBVTT". Now it correctly outputs: --- <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:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2499