mpv-player / mpv-player/mpv

Incorrect duration of ASS subtitles

Open
#12,492 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:win
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important Information

Provide following Information:

Reproduction steps
  1. Play videos with the sample subtitle.
  2. Seek to 23m50s, continue playing until the end.
Expected behavior

The duration of the sample subtitles is displayed normally, just like vlc.

Actual behavior

The duration of the last subtitle event is incorrect, it always appears on the screen until the end of the video.

https://github.com/mpv-player/mpv/assets/61936050/950ea221-2ec0-4934-8fd4-f6ae222923cc

The problem here is that the last subtitle event in the sample subtitle file has an incorrect duration, and mpv did not process it correctly.

Dialogue: 1,0:23:57.49,0:23:57.45,ed  - jp,,0,0,0,fx,{\an5\\t(0,100,\3c&H000000&)\t(100,200,\3c&HA0FF00&)\t(200,300,\3c&H000000&)\t(300,400,\3c&HA0FF00&)\t(400,500,\3c&H000000&)\t(500,600,\3c&HA0FF00&)\t(600,700,\3c&H000000&)\t(700,800,\3c&HA0FF00&)\t(800,900,\3c&H000000&)\t(900,1000,\3c&HA0FF00&)\t(1000,1100,\3c&H000000&)\t(1100,1200,\3c&HA0FF00&)\t(1200,1300,\3c&H000000&)\t(1300,1400,\3c&HA0FF00&)\t(1400,1500,\3c&H000000&)\t(1500,1600,\3c&HA0FF00&)\t(1600,1700,\3c&H000000&)\t(1700,1800,\3c&HA0FF00&)\t(1800,1900,\3c&H000000&)\t(1900,2000,\3c&HA0FF00&)\t(2000,2100,\3c&H000000&)\t(2100,2200,\3c&HA0FF00&)\t(2200,2300,\3c&H000000&)\t(2300,2400,\3c&HA0FF00&)\t(2400,2500,\3c&H000000&)\t(2500,2600,\3c&HA0FF00&)\t(2600,2700,\3c&H000000&)\t(2700,2800,\3c&HA0FF00&)\t(2800,2900,\3c&H000000&)\t(2900,3000,\3c&HA0FF00&)\t(3000,3100,\3c&H000000&)\t(3100,3200,\3c&HA0FF00&)\t(3200,3300,\3c&H000000&)\t(3300,3400,\3c&HA0FF00&)\t(3400,3500,\3c&H000000&)\t(3500,3600,\3c&HA0FF00&)\t(3600,3700,\3c&H000000&)\t(3700,3800,\3c&HA0FF00&)\t(3800,3900,\3c&H000000&)\t(3900,4000,\3c&HA0FF00&)\t(4000,4100,\3c&H000000&)\t(4100,4200,\3c&HA0FF00&)\t(4200,4300,\3c&H000000&)\t(4300,4400,\3c&HA0FF00&)\t(4400,4500,\3c&H000000&)\t(4500,4600,\3c&HA0FF00&)\t(4600,4700,\3c&H000000&)\t(4700,4800,\3c&HA0FF00&)\t(4800,4900,\3c&H000000&)\t(4900,5000,\3c&HA0FF00&)\t(5000,5100,\3c&H000000&)\t(5100,5200,\3c&HA0FF00&)\t(5200,5300,\3c&H000000&)\t(5300,5400,\3c&HA0FF00&)\t(5400,5500,\3c&H000000&)\t(5500,5600,\3c&HA0FF00&)\t(5600,5700,\3c&H000000&)\bord3\shad2\blur15\be3\pos(820,37)}い

Commit https://github.com/mpv-player/mpv/commit/740b7013ba827ce5a9d48138af5bd2e8f5d54710 introduced handling for subtitles with unknown duration, but it is obvious that this processing method is not correct enough and needs to be fixed.
Maybe we can refer to how it was handled in sd_lavc

Log file

mpv.log

Sample file

[Nekomoe kissaten&VCB-Studio] Mahou Shoujo Site [01][Ma10p_1080p][x265_flac].sc.zip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied ASS sample and the unknown-duration handling introduced in commit 740b7013ba827ce5a9d48138af5bd2e8f5d54710; compare it with the handling referenced in sd_lavc. Reproduce the issue by seeking to 23m50s, then verify that the final subtitle event ends at its intended time instead of remaining visible until the video ends.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.