From d470766000250ada785da3513dc7a476447e7e73 Mon Sep 17 00:00:00 2001 From: Mohammad AlSaleh Date: Sat, 28 Oct 2023 15:54:43 +0300 Subject: sub: add --sub-stretch-durations option Stretch a subtitle duration so it ends when the next one starts. Should help with subtitles which erroneously have zero durations. I found such a subrip substitles stream in the wild. Signed-off-by: Mohammad AlSaleh --- sub/sd_ass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sub/sd_ass.c') diff --git a/sub/sd_ass.c b/sub/sd_ass.c index bbf3218f49..6742f6f658 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -341,7 +341,8 @@ static void decode(struct sd *sd, struct demux_packet *packet) double sub_duration = 0; char **r = lavc_conv_decode(ctx->converter, packet, &sub_pts, &sub_duration); - if (packet->duration < 0 || sub_duration == UINT32_MAX) { + if (sd->opts->sub_stretch_durations || + packet->duration < 0 || sub_duration == UINT32_MAX) { if (!ctx->duration_unknown) { MP_WARN(sd, "Subtitle with unknown duration.\n"); ctx->duration_unknown = true; -- cgit v1.2.3