Skip to content

Error selecting PGS subtitles #112

Closed

Description

@ijuniorfu

What happened?

Error selecting PGS subtitles

[pgssub @ 0x9daa5f480] [error] Invalid object id 0
[AetherEngine] subtitle first cue: pktPTS=108994223 → startTime=1211.047s endTime=4296178.342s

Steps to reproduce

No response

AetherEngine version or commit SHA

83cffa7

Host app

AetherPlayer

Platform

macOS

OS version

macOS 26.5.1

Device / chip

Mac mini m4

Playback path

Native AVPlayer

Source media (for playback bugs)

No response

Error codes / log lines


Anything else

test.pgs.log.txt

Activity

  1. added
    bug
    on Jul 7, 2026
  2. added a commit that references this issue on Jul 7, 2026
  3. superuser404notfound commented on Jul 7, 2026

    @superuser404notfound
    Owner

    Thanks for the log, that made it easy to pin down. Two things showed up in it, and only one was a real bug.

    [pgssub] Invalid object id 0 (the actual bug). AetherPlayer runs a workaround for MKV rips whose converter drops the trailing "end of display set" marker from each PGS subtitle: after such a packet it injects a synthetic marker so the cue still renders. That workaround assumed every packet carries one complete subtitle display set. On a Blu-ray (M2TS) a single display set is split across several packets, so the synthetic marker fired on an early packet, before the bitmap object had arrived, and the decoder tried to draw an object it had not been given yet. That is the repeated error. It is now gated so the flush only runs once the packet actually carries a complete object, which never happens mid-split, so the error is gone.

    endTime=4296178s (not a bug). PGS subtitles have no built-in end time; a line ends only when the next composition clears it. The engine stamps an open-ended placeholder and closes it when the following cue arrives, so that large number is expected and never reaches the screen.

    Fixed in AetherPlayer 0.9.8 (AetherEngine cdef8a3), just released. Update via the built-in updater or grab the DMG from the release page, then reselect the PGS track. Could you confirm the error is gone and the subtitles show correctly? Leaving this open until you do.

  4. ijuniorfu commented on Jul 7, 2026

    @ijuniorfu
    Author

    1.Subtitle timing is out of sync.

    test.pgs.1.log.txt

    2.Subtitles not displaying

    test.pgs.2.log.txt

  5. superuser404notfound commented on Jul 7, 2026

    @superuser404notfound
    Owner

    Thanks for the logs, they pinned it down. Good news first: the "Invalid object id 0" error is gone in your logs, so that fix held.

    The two new symptoms (out of sync, and not displaying) were the same underlying issue, and separate from the earlier crash. The subtitle overlay was comparing each cue against the playback clock. On a Blu-ray title that clock is offset from the source timeline by the disc's start origin, so the subtitles were shifted by that amount: a few seconds off on one title (out of sync), and far enough off on another that they fell outside the visible window (never displayed). The overlay now compares cues against the source-PTS clock instead, so they line up on discs and regular files alike. Regular (non-disc) media was never affected, which is why this only showed up on your Blu-ray.

    Fixed in AetherPlayer 0.9.9, just released. Update via the built-in updater or grab the DMG from the release page, then reselect the PGS track. Could you confirm the subtitles now appear and stay in sync on both titles? Leaving this open until you do.

  6. ijuniorfu commented on Jul 8, 2026

    @ijuniorfu
    Author

    When I fast-forward to a later point, the subtitles don't appear immediately; it takes ten or several tens of seconds for them to show up. Is this due to a network issue?

    pgs.ttest.log.txt

  7. ijuniorfu commented on Jul 8, 2026

    @ijuniorfu
    Author

    Switching audio tracks and fast-forwarding both affect subtitle display.

  8. superuser404notfound commented on Jul 8, 2026

    @superuser404notfound
    Owner

    Thanks for the follow-up, both logs pinned it. This is a separate issue from the crash and the sync offset, and it is not the network.

    PGS (Blu-ray) subtitles are stateful: a line appears once, from its composition, and stays on screen until the next line clears it, often tens of seconds later. When you fast-forward (or switch the audio track, which restarts the same subtitle reader), the reader re-seeked to a fixed 2 seconds before the new position. On a Blu-ray that lands after the current line's composition, so the decoder never sees the definition and cannot rebuild the line that should already be on screen. Nothing shows until the next fresh line arrives, which on sparse dialogue is the "ten or several tens of seconds" you saw. Your log confirms it exactly: after a seek to 579.6 s the first subtitle to reappear starts at 593.7 s, a 14 second hole.

    The reader now scans backward in growing steps until it has decoded the line active at your position, then starts there, so the current line reappears right after the seek. A genuine gap between lines is detected and adds no delay.

    Fixed in AetherPlayer 0.9.13, just released (AetherEngine b949699). Update via the built-in updater or grab the DMG from the release page, then reselect the PGS track. Could you confirm the subtitles reappear promptly after fast-forward and after an audio-track switch, on both titles? Leaving this open until you do.

  9. ijuniorfu commented on Jul 8, 2026

    @ijuniorfu
    Author

    The subtitles aren't showing up now.

    pgs.test.log.txt

  10. superuser404notfound commented on Jul 8, 2026

    @superuser404notfound
    Owner

    Thanks for the log, that was the whole story. The "not showing up" is on me: 0.9.13's fix was too expensive on your remote Blu-ray, so it made things worse instead of better.

    The 0.9.13 fix reconstructed the on-screen line by scanning backward in steps and probing each candidate before playing. On a regular file that is nearly free, but a remote Blu-ray is a concat MPEG-TS with no seek index, so each probe had to re-download its whole look-back span. Where the dialogue is sparse it scanned to the full 60 second limit, re-reading about a hundred seconds of the disc per attempt, and the reader was replaced (by the next seek or the audio-track switch) before it drew a single line. Your log shows it exactly: three subtitle readers, every one read zero packets, no cues the entire session.

    The reconstruction was already handled elsewhere in the engine, so the probing was redundant. The reader now seeks back once and rebuilds the active line in a single forward pass, and it stops immediately when a seek supersedes it. On a disc that look-back is capped tight so nothing is re-downloaded; regular files keep the full window. So subtitles appear promptly and still reconstruct after a fast-forward or audio-track switch.

    Fixed in AetherPlayer 0.9.14 (AetherEngine e9e2bb2), just released. Update via the built-in updater or grab the DMG from the release page, then reselect the PGS track. Could you confirm the subtitles show up and stay correct on both titles, including after a fast-forward and an audio-track switch? Leaving this open until you do.

  11. 37 remaining items

  12. superuser404notfound commented on Jul 10, 2026

    @superuser404notfound
    Owner

    Thanks for the two logs, and sorry for the regression. They pinned it precisely: both show the decoder rejecting every subtitle composition with "Invalid palette id" while packets were flowing, which means it kept receiving display sets with their palette definition missing.

    The 0.9.22 rework takes subtitle packets straight from the main playback connection and keeps them in a session store. That store assumed each packet is a complete, self-contained subtitle unit. That holds for MKV files (where 0.9.22 was verified), but not for a Blu-ray ISO: there one PGS display set arrives split across several packets (composition, window, palette, object, end), some carrying no timestamp of their own and some sharing one. The store silently dropped the former and collapsed the latter, so the palette and object definitions never reached the decoder and every single set failed. That is why nothing displayed at all on either of your titles.

    The store now reassembles those split packets into one complete display set before anything is decoded, so the decoder always sees composition, palette, and object together. This applies to local and remote ISOs alike; MKV playback is untouched.

    Shipped in AetherPlayer 0.9.23 (AetherEngine bb13e2d). Update via the built-in updater or grab the DMG from the release page, then reselect the PGS track.

    Could you run the usual pass on both remote ISOs once more: subtitles enabled from the start, a seek to a specific time (the 16:00 case), a fast-forward, an audio-track switch, and a subtitle-track switch? With the display sets intact and no recovery machinery left, this should now beat 0.9.20 rather than just match it. Leaving this open until you confirm.

  13. ijuniorfu commented on Jul 10, 2026

    @ijuniorfu
    Author

    Check: after a fast-forward, after an audio-track switch, after an subtitle-track switch

    AetherPlayer 0.9.23 (AetherEngine bb13e2d)

    Absolutely perfect; the subtitles appeared almost immediately.

  14. superuser404notfound commented on Jul 10, 2026

    @superuser404notfound
    Owner

    Letsgo! Glad we finally fixed it and thank you for all your testing!

  15. added a commit that references this issue on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions