[Bug]: Chapters not sorted when embedded in audio file in incorrect order #2012

Closed
opened 2026-04-25 00:02:23 +02:00 by adam · 1 comment
Owner

Originally created by @advplyr on GitHub (May 24, 2024).

What happened?

Scanned in a single file m4b audiobook with embedded chapters. The embedded chapters have an id in ascending order but the start timestamps are not.
When using embedded chapters Abs is sorting by id instead of start causing the chapters to be in an incorrect order.

What did you expect to happen?

Sort by chapter start

Steps to reproduce the issue

  1. Audio file with embedded chapters where the start times are not ascending
  2. Scan audiobook & review chapters

Audiobookshelf version

v2.9.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

{
      "id": 97,
      "time_base": "1/1000",
      "start": 34725255,
      "start_time": "34725.255000",
      "end": 35026107,
      "end_time": "35026.107000",
      "tags": {
        "title": "Chapter 98"
      }
    },
    {
      "id": 98,
      "time_base": "1/1000",
      "start": 35026107,
      "start_time": "35026.107000",
      "end": 35401434,
      "end_time": "35401.434000",
      "tags": {
        "title": "Chapter 99"
      }
    },
    {
      "id": 99,
      "time_base": "1/1000",
      "start": 0,
      "start_time": "0.000000",
      "end": 7862,
      "end_time": "7.862000",
      "tags": {
        "title": "Introduction"
      }

Additional Notes

image

Originally created by @advplyr on GitHub (May 24, 2024). ### What happened? Scanned in a single file m4b audiobook with embedded chapters. The embedded chapters have an `id` in ascending order but the `start` timestamps are not. When using embedded chapters Abs is sorting by `id` instead of `start` causing the chapters to be in an incorrect order. ### What did you expect to happen? Sort by chapter `start` ### Steps to reproduce the issue 1. Audio file with embedded chapters where the `start` times are not ascending 2. Scan audiobook & review chapters ### Audiobookshelf version v2.9.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Windows ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell { "id": 97, "time_base": "1/1000", "start": 34725255, "start_time": "34725.255000", "end": 35026107, "end_time": "35026.107000", "tags": { "title": "Chapter 98" } }, { "id": 98, "time_base": "1/1000", "start": 35026107, "start_time": "35026.107000", "end": 35401434, "end_time": "35401.434000", "tags": { "title": "Chapter 99" } }, { "id": 99, "time_base": "1/1000", "start": 0, "start_time": "0.000000", "end": 7862, "end_time": "7.862000", "tags": { "title": "Introduction" } ``` ### Additional Notes ![image](https://github.com/advplyr/audiobookshelf/assets/67830747/274ed727-0f44-4a1a-a0a5-86dea8fdf283)
adam added the bug label 2026-04-25 00:02:23 +02:00
adam closed this issue 2026-04-25 00:02:24 +02:00
Author
Owner

@advplyr commented on GitHub (May 27, 2024):

Fixed in v2.10.0

@advplyr commented on GitHub (May 27, 2024): Fixed in [v2.10.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.10.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2012