[FFmpeg-devel] [PATCH] lavf/jacosubdec: compute subtitle duration correctly

Adam Sampson ats at offog.org
Wed Feb 13 01:13:20 EET 2019


When a JACOsub subtitle has two timestamps, they represent its start and
end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the
duration is the difference between the two, not the sum of the two.

Tested using MPV, a LaserDisc, and some authentic 1993 JACOsub files.
---
 libavformat/jacosubdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..f6be5df2d7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -127,7 +127,7 @@ shift_and_ret:
     ts_start  = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
     ts_end    = (ts_end   + jacosub->shift) * 100 / jacosub->timeres;
     *start    = ts_start;
-    *duration = ts_start + ts_end;
+    *duration = ts_end - ts_start;
     return buf + len;
 }
 
-- 
2.20.1



More information about the ffmpeg-devel mailing list