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

Nicolas George george at nsup.org
Mon May 26 10:31:14 CEST 2014


Le septidi 7 prairial, an CCXXII, Aman Gupta a écrit :
> 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);

I am sorry, but this change seems wrong to me: if the flag is supposed to be
present, that is not ffmpeg.c's task to set it. Otherwise, applications
using the library directly would not get it.

I believe we do not currently have subtitles encoders that use
non-key-frames, although some formats would make it possible. In that case,
I suppose the flag can be set in avcodec_encode_subtitle().

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140526/16abcf08/attachment.asc>


More information about the ffmpeg-devel mailing list