[FFmpeg-devel] [PATCH v2] ffmpeg: add AV_PKT_FLAG_KEY to packets in output subtitle streams

Aman Gupta ffmpeg at tmm1.net
Mon May 26 09:08:10 CEST 2014


Allows subtitle streams to be segmented on pts timestamps.
After this patch ffmpeg can be used to generate segmented wevtt subtitle
tracks for HLS streaming:

  ffmpeg -i input.srt -c:s webvtt -f segment -segment_time 10 out%5d.vtt

Signed-off-by: Aman Gupta <ffmpeg at tmm1.net>
---
 ffmpeg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index 5299f0e..6e743e2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -821,6 +821,7 @@ static void do_subtitle_out(AVFormatContext *s,
         }
 
         av_init_packet(&pkt);
+        pkt.flags |= AV_PKT_FLAG_KEY;
         pkt.data = subtitle_out;
         pkt.size = subtitle_out_size;
         pkt.pts  = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
-- 
1.9.1



More information about the ffmpeg-devel mailing list