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

Jan Ekström jeebjp at gmail.com
Fri Mar 20 18:03:53 EET 2020


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.

(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)

Best regards,
Jan


More information about the ffmpeg-devel mailing list