diff options
author | Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com> | 2023-10-28 15:54:43 +0300 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-11-07 20:46:40 +0000 |
commit | d470766000250ada785da3513dc7a476447e7e73 (patch) | |
tree | a75579ab409735bc935411f381e2fe7a043d3d8a /sub/sd_ass.c | |
parent | c2b3d967baf0f38807764ee9a04d620de19d3403 (diff) | |
download | mpv-d470766000250ada785da3513dc7a476447e7e73.tar.bz2 mpv-d470766000250ada785da3513dc7a476447e7e73.tar.xz |
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 <CE.Mohammad.AlSaleh@gmail.com>
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r-- | sub/sd_ass.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |