[FFmpeg-devel] [PATCH] avformat/segment: segment subtitle streams

Clément Bœsch u at pkh.me
Wed May 14 09:41:17 CEST 2014


On Sun, May 11, 2014 at 03:16:30PM -0700, ffmpeg at tmm1.net wrote:
> 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,

Unless I'm mistaken the AV_PKT_FLAG_KEY should be set for subtitles
packets. See in ff_subtitles_queue_insert()

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140514/76a51436/attachment.asc>


More information about the ffmpeg-devel mailing list