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

Michael Niedermayer michaelni at gmx.at
Mon May 26 14:12:44 CEST 2014


On Mon, May 26, 2014 at 10:31:14AM +0200, Nicolas George wrote:
> 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().

This would be the logical thing to do, sadly avcodec_encode_subtitle()
doesnt have a AVPacket parameter like the audio/video encode functions

so something like amans patch or a avcodec_encode_subtitle2() would
probably be needed.


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140526/54533704/attachment.asc>


More information about the ffmpeg-devel mailing list