PR #25969 opened by jb-alvarado
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25969
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25969.patch

# Summary of changes

When setting `-hls_flags program_date_time` all m3u8 playlists got the correct 
`#EXT-X-PROGRAM-DATE-TIME` flag, except the Webvtt playlist.

This patch adds missing `#EXT-X-PROGRAM-DATE-TIME` to the Webvtt subtitle 
playlist.


>From f9644bcbcc336121803f0461d235e1c2647dc8e7 Mon Sep 17 00:00:00 2001
From: jb-alvarado <[email protected]>
Date: Thu, 12 Nov 2026 12:43:19 +0100
Subject: [PATCH] Apply EXT-X-PROGRAM-DATE-TIME also to WebVTT playlist

---
 libavformat/hlsenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e35af34d230..0d1d78f919b 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1661,10 +1661,15 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
         }
         ff_hls_write_playlist_header(hls->sub_m3u8_out, hls->version, 
hls->allowcache,
                                      target_duration, sequence, 
PLAYLIST_TYPE_NONE, 0);
+        prog_date_time = vs->initial_prog_date_time;
         for (en = vs->segments; en; en = en->next) {
             ret = ff_hls_write_file_entry(hls->sub_m3u8_out, en->discont, 
byterange_mode,
                                           en->duration, 0, en->size, en->pos,
-                                          hls->baseurl, en->sub_filename, 
NULL, 0);
+                                          hls->baseurl, en->sub_filename,
+                                          en->discont_program_date_time ? 
&en->discont_program_date_time : prog_date_time_p,
+                                          0);
+            if (en->discont_program_date_time)
+                en->discont_program_date_time -= en->duration;
             if (ret < 0) {
                 av_log(s, AV_LOG_WARNING, "ff_hls_write_file_entry get 
error\n");
             }
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to