[FFmpeg-devel] [PATCH v1] fftools/ffmpeg: set AV_PKT_FLAG_KEY for the subtitle packet

Limin Wang lance.lmwang at gmail.com
Sat Mar 21 01:28:22 EET 2020


On Fri, Mar 20, 2020 at 06:03:53PM +0200, Jan Ekström wrote:
> On Fri, Mar 20, 2020 at 5:45 PM <lance.lmwang at gmail.com> wrote:
> >
> > From: Limin Wang <lance.lmwang at gmail.com>
> >
> > This fixes webvtt segment output.
> >
> > Please testing with the following command and check the output:
> > ./ffmpeg -i ../fate-suite/sub/MicroDVD_capability_tester.srt -f segment -segment_time 10 \
> >     -segment_list_size 0  -segment_list sub.m3u8 -segment_format webvtt -scodec webvtt sub-%d.vtt
> >
> >
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> >  fftools/ffmpeg.c                 |  1 +
> >  tests/ref/fate/binsub-movtextenc |  2 +-
> >  tests/ref/fate/sub2video         | 86 ++++++++++++++++----------------
> >  3 files changed, 45 insertions(+), 44 deletions(-)
> >
> > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> > index aaaf241314..c5a2d0731d 100644
> > --- a/fftools/ffmpeg.c
> > +++ b/fftools/ffmpeg.c
> > @@ -1054,6 +1054,7 @@ static void do_subtitle_out(OutputFile *of,
> >              else
> >                  pkt.pts += av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->mux_timebase);
> >          }
> > +        pkt.flags |= AV_PKT_FLAG_KEY;
> >          pkt.dts = pkt.pts;
> >          output_packet(of, &pkt, ost, 0);
> >      }
> 
> I do wonder if this is just a case of people forgetting to set the
> flag for the relevant packets in the relevant modules?
> 
> I'm not sure if all API users should be forced to handle this
> separately. If the packets are decode'able by themselves, they should
> be marked as such.

If we're using -c:s copy for the subtitle, the flag is set in 
ff_subtitles_queue_insert() of libavformat/subtitles.c.

> 
> (Unfortunately, this probably means that all subtitle encoders and
> text-based subtitle format demuxers would have to be updated where
> this flag is not set)

subtitle encoder haven no way to set the flag in the encoder api now.

> 
> Best regards,
> Jan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang


More information about the ffmpeg-devel mailing list