ASS: first dialogue event is not displayed if the file contains any zero-duration event (with FFmpeg 9.0)

Open
#18,532 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the issue with repro.ass and control.ass using the provided ffmpeg and mpv commands, then trace the --sub-file path and ASS timing handling, including the --sub-fix-timing and --sub-ass options. Use the zero-duration event and the chronological first dialogue event as the focused case; done means the first line renders from 0:01 to 0:03 while the zero-duration event does not suppress other events.

Written by the indexing model from the issue text.

Description

output.txt

mpv Information
mpv v0.41.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Aug 10 2026 19:32:19
libplacebo version: v7.360.1
FFmpeg version: 9.0 (runtime 9.0.2)
FFmpeg library versions:
   libavcodec      63.1.100 (runtime 63.1.102)
   libavdevice     63.1.100 (runtime 63.1.102)
   libavfilter     12.1.100 (runtime 12.1.102)
   libavformat     63.1.100 (runtime 63.1.102)
   libavutil       61.1.100 (runtime 61.1.102)
   libswresample   7.1.100 (runtime 7.1.102)
   libswscale      10.1.100 (runtime 10.1.102)
libass 0.17.5
Other Information
- Linux version: Ubuntu 22.04.5 LTS
- Kernel Version: 6.8.0-138-generic aarch64
- GPU Model: n/a (reproduced headless with --vo=image; also observed with jellyfin-mpv-shim on Windows)
- Mesa/GPU Driver Version: n/a
- Window Manager and Version: n/a
- Source of mpv: conda-forge package mpv 0.41.0
- Latest known working version: unknown
- Issue started after the following happened: n/a
Reproduction Steps

If an external ASS file contains any zero-duration event (Start == End), the chronologically first dialogue event of the file is never displayed. It does not matter whether the zero-duration event is empty or has text, or where it is placed (before the first line, between lines, or at the very end of the file).

Minimal file (repro.ass):

[Script Info]
ScriptType: v4.00+
PlayResX: 1920
PlayResY: 1080

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,sans-serif,72,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,3,0,2,20,20,40,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.00,0:00:03.00,Default,,0,0,0,,First line
Dialogue: 0,0:00:04.00,0:00:06.00,Default,,0,0,0,,Second line
Dialogue: 0,0:00:07.00,0:00:07.00,Default,,0,0,0,,

control.ass is identical except that the last (zero-duration) line is removed.

ffmpeg -f lavfi -i color=c=black:s=1920x1080:r=24:d=10 -c:v libx264 black10.mkv
mpv --no-config black10.mkv --sub-file=repro.ass     # "First line" never appears
mpv --no-config black10.mkv --sub-file=control.ass   # "First line" appears at 0:01

Same result when playing from the start or when seeking (--start=2). Additional observations:

  • Changing the last line to a non-zero duration (e.g. 0:00:07.00,0:00:08.00) makes "First line" appear again.
  • Moving the zero-duration line to the top of the file or between the two lines gives the same result: only the chronologically first event is lost; all other events display correctly.
  • --sub-fix-timing=no/yes and --sub-ass=no make no difference.
  • ffmpeg -i repro.ass -f srt - lists all three events correctly, and libass rendering through ffmpeg's subtitles filter shows "First line", so the events seem to reach mpv correctly.

Possibly related to the unknown-duration workaround discussed in #12492 (commit 740b7013ba827ce5a9d48138af5bd2e8f5d54710), since a zero duration may be treated as "unknown".

Real-world impact: many fansub ASS files contain leftover empty 0:00:00.00,0:00:00.00 lines, so their first line of dialogue silently disappears in mpv (and in frontends using it, e.g. jellyfin-mpv-shim), while other players show it.

Expected Behavior

"First line" is displayed from 0:01 to 0:03. Zero-duration events are either ignored or shown for zero time, without affecting other events.

Actual Behavior

"First line" is never displayed. "Second line" displays normally.

Log File

Log produced with mpv --no-config --no-audio --vo=image --start=2 --frames=1 --sub-file=repro.ass --log-file=output.txt black10.mkv (paths redacted). Headless environment, so --gpu-debug was not applicable.

output.txt
[   0.001][v][cplayer] mpv v0.41.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
[   0.001][v][cplayer]  built on Aug 10 2026 19:32:19
[   0.001][v][cplayer] libplacebo version: v7.360.1
[   0.001][v][cplayer] FFmpeg version: 9.0 (runtime 9.0.2)
[   0.001][v][cplayer] FFmpeg library versions:
[   0.001][v][cplayer]    libavcodec      63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavdevice     63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavfilter     12.1.100 (runtime 12.1.102)
[   0.001][v][cplayer]    libavformat     63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavutil       61.1.100 (runtime 61.1.102)
[   0.001][v][cplayer]    libswresample   7.1.100 (runtime 7.1.102)
[   0.001][v][cplayer]    libswscale      10.1.100 (runtime 10.1.102)
[   0.001][v][cplayer] Configuration: -Dbuildtype=release -Dhtml-build=disabled -Dmanpage-build=disabled -Dswift-build=disabled -Dcocoa=disabled -Dlibmpv=true -Dlibarchive=enabled -Dzimg=disabled -Dwayland=disabled -Dmacos-11-3-features=disabled -Dmacos-11-features=disabled -Dmacos-12-features=disabled -Dsysconfdir=/home/user/mp/.pixi/envs/default/etc -Ddatadir=/home/user/mp/.pixi/envs/default/share -Dprefix=/home/user/mp/.pixi/envs/default -Dlibdir=lib --cross-file=<conda-build>
[   0.001][v][cplayer] List of enabled features: alsa build-date cplugins dvbin ffmpeg gl glibc-thread-name glob glob-posix gpl iconv jpeg lcms2 libarchive libass libavdevice libdl libplacebo linux-fstatfs memrchr posix ppoll pthread-condattr-setclock pulse uchardet vapoursynth vector vt.h zlib
[   0.001][v][cplayer] Built with NDEBUG.
[   0.001][v][cplayer] Command line options: '--no-config' '--no-audio' '--vo=image' '--vo-image-outdir=/home/user/w/repro/out' '--start=2' '--frames=1' '--sub-file=/home/user/w/repro/repro.ass' '--log-file=/home/user/w/repro/output.txt' '/home/user/w/repro/black10.mkv'
[   0.001][v][cplayer] mpv v0.41.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
[   0.001][v][cplayer]  built on Aug 10 2026 19:32:19
[   0.001][v][cplayer] libplacebo version: v7.360.1
[   0.001][v][cplayer] FFmpeg version: 9.0 (runtime 9.0.2)
[   0.001][v][cplayer] FFmpeg library versions:
[   0.001][v][cplayer]    libavcodec      63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavdevice     63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavfilter     12.1.100 (runtime 12.1.102)
[   0.001][v][cplayer]    libavformat     63.1.100 (runtime 63.1.102)
[   0.001][v][cplayer]    libavutil       61.1.100 (runtime 61.1.102)
[   0.001][v][cplayer]    libswresample   7.1.100 (runtime 7.1.102)
[   0.001][v][cplayer]    libswscale      10.1.100 (runtime 10.1.102)
[   0.001][v][cplayer] Configuration: -Dbuildtype=release -Dhtml-build=disabled -Dmanpage-build=disabled -Dswift-build=disabled -Dcocoa=disabled -Dlibmpv=true -Dlibarchive=enabled -Dzimg=disabled -Dwayland=disabled -Dmacos-11-3-features=disabled -Dmacos-11-features=disabled -Dmacos-12-features=disabled -Dsysconfdir=/home/user/mp/.pixi/envs/default/etc -Ddatadir=/home/user/mp/.pixi/envs/default/share -Dprefix=/home/user/mp/.pixi/envs/default -Dlibdir=lib --cross-file=<conda-build>
[   0.001][v][cplayer] List of enabled features: alsa build-date cplugins dvbin ffmpeg gl glibc-thread-name glob glob-posix gpl iconv jpeg lcms2 libarchive libass libavdevice libdl libplacebo linux-fstatfs memrchr posix ppoll pthread-condattr-setclock pulse uchardet vapoursynth vector vt.h zlib
[   0.001][v][cplayer] Built with NDEBUG.
[   0.001][d][global] home path: '' -> '-'
[   0.001][d][global] user path: '~~home/' -> ''
[   0.001][d][global] user path: '~~old_home/' -> ''
[   0.001][v][cplayer] Setting option 'config' = 'no' (flags = 8)
[   0.001][v][cplayer] Setting option 'audio' = 'no' (flags = 8)
[   0.001][v][cplayer] Setting option 'vo' = 'image' (flags = 8)
[   0.001][v][cplayer] Setting option 'vo-image-outdir' = '/home/user/w/repro/out' (flags = 8)
[   0.001][v][cplayer] Setting option 'start' = '2' (flags = 8)
[   0.001][v][cplayer] Setting option 'frames' = '1' (flags = 8)
[   0.001][v][cplayer] Setting option 'sub-files-append' = '/home/user/w/repro/repro.ass' (flags = 8)
[   0.001][v][cplayer] Setting option 'log-file' = '/home/user/w/repro/output.txt' (flags = 8)
[   0.002][v][clipboard] Initialized vo clipboard backend.
[   0.002][d][global] state path: 'watch_later' -> '-'
[   0.002][d][global] state path: 'watch_later' -> '-'
[   0.002][v][file] Opening /home/user/w/repro/black10.mkv
[   0.002][d][file] resize stream to 131072 bytes, drop 0 bytes
[   0.002][d][file] Stream opened successfully.
[   0.002][v][demux] Trying demuxers for level=normal.
[   0.002][d][demux] Trying demuxer: directory (force-level: normal)
[   0.003][d][demux] Trying demuxer: disc (force-level: normal)
[   0.003][d][demux] Trying demuxer: edl (force-level: normal)
[   0.003][d][demux] Trying demuxer: cue (force-level: normal)
[   0.003][d][demux] Trying demuxer: rawaudio (force-level: normal)
[   0.003][d][demux] Trying demuxer: rawvideo (force-level: normal)
[   0.003][d][demux] Trying demuxer: mkv (force-level: normal)
[   0.003][d][mkv] Found the head...
[   0.003][d][mkv] + a segment...
[   0.003][d][mkv] Parsing seek head...
[   0.003][d][mkv] |+ segment information...
[   0.003][d][mkv] float 10000.000000
[   0.003][d][mkv] | + muxing app: Lavf58.76.100
[   0.003][d][mkv] | + writing app: Lavf58.76.100
[   0.003][d][mkv] | + timecode scale: 1000000
[   0.003][d][mkv] | + duration: 10.000s
[   0.003][d][mkv] | + segment uid 06 7b 44 0d 55 9b eb 30 5e 34 44 a6 4f b8 73 05
[   0.003][d][mkv] |+ segment tracks...
[   0.003][d][mkv] | + a track...
[   0.003][d][mkv] |  + Track number: 1
[   0.003][d][mkv] |  + Track type: Video
[   0.003][d][mkv] |  + Video track
[   0.003][d][mkv] |   + Pixel width: 1920
[   0.003][d][mkv] |   + Pixel height: 1080
[   0.003][d][mkv] |  + Codec ID: V_MPEG4/ISO/AVC
[   0.003][d][mkv] |  + CodecPrivate, length 40
[   0.003][d][mkv] |  + Language: und
[   0.003][d][mkv] |  + Default duration: 41.667ms ( = 24.000 fps)
[   0.003][d][mkv] |+ found cluster
[   0.003][v][mkv] Deferring reading cues.
[   0.003][v][mkv] All headers are parsed!
[   0.003][v][demux] Detected file format: Matroska
[   0.003][v][cplayer] Opening done: /home/user/w/repro/black10.mkv
[   0.003][v][file] Opening /home/user/w/repro/repro.ass
[   0.003][d][file] resize stream to 131072 bytes, drop 0 bytes
[   0.003][d][file] Stream opened successfully.
[   0.003][v][demux] Trying demuxers for level=normal.
[   0.003][d][demux] Trying demuxer: directory (force-level: normal)
[   0.004][d][demux] Trying demuxer: disc (force-level: normal)
[   0.004][d][demux] Trying demuxer: edl (force-level: normal)
[   0.004][d][demux] Trying demuxer: cue (force-level: normal)
[   0.004][d][demux] Trying demuxer: rawaudio (force-level: normal)
[   0.004][d][demux] Trying demuxer: rawvideo (force-level: normal)
[   0.004][d][demux] Trying demuxer: mkv (force-level: normal)
[   0.004][d][demux] Trying demuxer: libarchive (force-level: normal)
[   0.004][d][demux] Trying demuxer: lavf (force-level: normal)
[   0.006][v][lavf] Found 'ass' at score=100 size=691.
[   0.007][v][lavf] avformat_find_stream_info() finished after 691 bytes.
[   0.007][v][lavf] demuxer read all data; closing stream
[   0.007][v][demux] Detected file format: ass (libavformat)
[   0.007][v][find_files] Loading external files in /home/user/w/repro/
[   0.007][v][mkv] select track 0
[   0.007][v][lavf] select track 0
[   0.007][v][lavf] refresh track 0 (sub)
[   0.007][v][lavf] refresh seek to -10.000000
[   0.007][i][cplayer] ● Video  --vid=1  (h264 1920x1080 24 fps) [default]
[   0.007][i][cplayer] ● Subs   --sid=1  'repro.ass' (ass) [external]
[   0.007][i][vo/image] Creating output directory '/home/user/w/repro/out'...
[   0.008][v][vd] Container reported FPS: 24.000000
[   0.008][v][vd] Codec list:
[   0.008][v][vd]     h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[   0.008][v][vd]     h264_v4l2m2m (h264) - V4L2 mem2mem H.264 decoder wrapper
[   0.008][v][vd]     libopenh264 (h264) - OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[   0.008][v][vd]     h264_cuvid (h264) - Nvidia CUVID H264 decoder
[   0.008][v][vd] Opening decoder h264
[   0.008][v][vd] No hardware decoding requested.
[   0.008][v][vd] Using software decoding.
[   0.008][v][vd] Detected 2 logical cores.
[   0.008][v][vd] Requesting 3 threads for decoding.
[   0.009][d][ffmpeg/video] h264: Reinit context to 1920x1088, pix_fmt: yuv420p
[   0.009][d][vd] DR parameter change to 1920x1090 yuv420p align=64
[   0.009][d][vd] Allocating new (host-cached) DR image...
[   0.009][d][vd] ...failed..
[   0.009][v][vd] DR failed - disabling.
[   0.011][v][vd] Selected decoder: h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[   0.011][v][vf] User filter list:
[   0.011][v][vf]   (empty)
[   0.011][d][sub/ass] ASS library version: 0x1705000 (runtime 0x1705000)
[   0.011][v][sub/ass] libass API version: 0x1705000
[   0.011][v][sub/ass] libass source: tarball: 0.17.5
[   0.011][v][sub/ass] Shaper: FriBidi 1.0.16 (SIMPLE) HarfBuzz-ng 14.5.0 (COMPLEX)
[   0.011][v][sub/ass] Setting up fonts...
[   0.016][v][sub/ass] Using font provider fontconfig
[   0.016][v][sub/ass] Done.
[   0.016][v][cplayer] Starting playback...
[   0.016][v][mkv] queuing seek to 2.000000
[   0.016][v][lavf] queuing seek to 2.000000 (cascade)
[   0.016][v][lavf] execute seek (to 2.000000 flags 0)
[   0.016][v][lavf] seek done
[   0.016][v][cplayer] hr-seek, skipping to 2.000000
[   0.016][v][mkv] execute seek (to 2.000000 flags 32)
[   0.016][v][mkv] Seeking to 11699 to read header element 0x1c53bb6b.
[   0.016][v][mkv] Parsing cues...
[   0.016][w][mkv] Discarding potentially broken or useless index.
[   0.016][v][mkv] creating index until TC 2005000000
[   0.016][v][mkv] seek done
[   0.016][v][lavf] queuing seek to 0.000000
[   0.016][v][lavf] execute seek (to 0.000000 flags 0)
[   0.016][v][lavf] seek done
[   0.016][v][lavf] EOF reached.
[   0.017][d][ffmpeg/video] h264: Reinit context to 1920x1088, pix_fmt: yuv420p
[   0.018][v][vd] Using software decoding.
[   0.018][v][vd] Decoder format: 1920x1080 yuv420p auto/auto/auto/auto/auto CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.018][v][vd] Using container aspect ratio.
[   0.018][v][vf] [in] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.018][v][vf] [userdeint] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.018][v][vf] [userdeint] (disabled)
[   0.018][v][vf] [autovflip] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.018][v][vf] [autovflip] (disabled)
[   0.018][v][vf] [autorotate] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.019][v][vf] [autorotate] (disabled)
[   0.019][v][vf] [convert] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.019][v][vf] [convert] (disabled)
[   0.019][v][vf] [out] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.048][i][cplayer] VO: [image] 1920x1080 yuv420p
[   0.048][v][cplayer] VO: Description: Write video frames to image files
[   0.048][v][vo/image] reconfig to 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.049][i][vo/image] Saving /home/user/w/repro/out/00000001.jpg
[   0.049][v][vo/image] input: 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display CL=mpeg2/4/h264 crop=1920x1080+0+0 A=none
[   0.049][v][vo/image] converted: 1920x1080 rgb24 rgb/bt.709/srgb/full/display CL=mpeg1/jpeg crop=1920x1080+0+0 A=none
[   0.049][d][ffmpeg] SwScaler: reducing / aligning filtersize 1 -> 4
[   0.049][d][ffmpeg] SwScaler: reducing / aligning filtersize 7 -> 8
[   0.049][d][ffmpeg] SwScaler: reducing / aligning filtersize 1 -> 1
[   0.050][d][ffmpeg] SwScaler: reducing / aligning filtersize 7 -> 6
[   0.050][v][ffmpeg] swscaler: Lanczos scaler, from yuv420p to rgb24 using C
[   0.050][d][ffmpeg] swscaler: 1920x1080 -> 1920x1080
[   0.050][v][vo/image] unaligned libswscale parameter; using slow copy.
[   0.066][v][cplayer] first video frame after restart shown
[   0.066][d][cplayer] starting video playback
[   0.066][v][cplayer] playback restart complete @ 2.000000, audio=eof, video=playing
[   0.067][v][cplayer] video EOF reached
[   0.067][d][cplayer] video EOF (status=4)
[   0.067][v][cplayer] EOF code: 1  
[   0.067][d][vd] Uninit decoder.
[   0.067][v][vf] dropping frame due to pin disconnect
[   0.068][d][cplayer] Terminating demuxers...
[   0.068][d][cplayer] Done terminating demuxers.
[   0.068][v][cplayer] finished playback, success (reason 0)
[   0.068][i][cplayer] Exiting... (End of file)
Sample Files

The sample is inlined above (repro.ass).

Dominant language
C
Stars
38.2k
Forks
3.7k
Avg merge
1d 13h
Merged PRs (30d)
76

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

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.

More from mpv-player/mpv

All issues in mpv-player/mpv

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.