[FFmpeg-devel] [PATCH] avformat/segment: segment subtitle streams
ffmpeg at tmm1.net
ffmpeg at tmm1.net
Mon May 12 00:16:30 CEST 2014
From: Aman Gupta <ffmpeg at tmm1.net>
Allows subtitle streams to be segmented on pts timestamps.
This can be used, for example, 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>
---
libavformat/segment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/segment.c b/libavformat/segment.c
index fe84f27..4a8d4d2 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -685,7 +685,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index == seg->reference_stream_index ? seg->frame_count : -1);
if (pkt->stream_index == seg->reference_stream_index &&
- pkt->flags & AV_PKT_FLAG_KEY &&
+ (pkt->flags & AV_PKT_FLAG_KEY || st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
(seg->frame_count >= start_frame ||
(pkt->pts != AV_NOPTS_VALUE &&
av_compare_ts(pkt->pts, st->time_base,
--
1.9.1
More information about the ffmpeg-devel
mailing list