Issue playing some .m4b files #90

Closed
opened 2026-02-20 00:16:23 -05:00 by deekerman · 9 comments
Owner

Originally created by @BLuR457 on GitHub (Nov 7, 2021).

Im having issues playing some .m4b files. Some work fine and others seem to have an ffmpeg error (see below). All mp3 files work fine. The files that don't work with audiobookshelf work fine with iTunes and Windows Media Player. All files were converted from .aax with OpenAudible. Any idea how to fix this? I can convert the files to .mp3 but id rather use .m4b.

`2021-11-08 04:01:30

INFO

[STREAM] START STREAM - Num Segments: 6004

2021-11-08 04:01:30

INFO

Stream Opened for client BLuR for audiobook Halo Divine Wind with streamId kvq50t4o

2021-11-08 04:01:30

INFO

[INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i /metadata/streams/kvq50t4o/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kvq50t4o/output-%d.ts /metadata/streams/kvq50t4o/final-output.m3u8

2021-11-08 04:01:30

INFO

2021-11-08 04:01:30

DEBUG

[DB] Updated user 1

2021-11-08 04:01:30

INFO

[adts @ 0x7f1a5bcb43c0] Scalable configurations are not allowed in ADTS

2021-11-08 04:01:30

INFO

Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

2021-11-08 04:01:30

INFO

Error initializing output stream 0:0 --

2021-11-08 04:01:30

INFO

2021-11-08 04:01:30

INFO

2021-11-08 04:01:30

ERROR

Ffmpeg Err ffmpeg exited with code 1: Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input Error initializing output stream 0:0 --`

Originally created by @BLuR457 on GitHub (Nov 7, 2021). Im having issues playing some .m4b files. Some work fine and others seem to have an ffmpeg error (see below). All mp3 files work fine. The files that don't work with audiobookshelf work fine with iTunes and Windows Media Player. All files were converted from .aax with OpenAudible. Any idea how to fix this? I can convert the files to .mp3 but id rather use .m4b. `2021-11-08 04:01:30 INFO [STREAM] START STREAM - Num Segments: 6004 2021-11-08 04:01:30 INFO Stream Opened for client BLuR for audiobook Halo Divine Wind with streamId kvq50t4o 2021-11-08 04:01:30 INFO [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -i /metadata/streams/kvq50t4o/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 0 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kvq50t4o/output-%d.ts /metadata/streams/kvq50t4o/final-output.m3u8 2021-11-08 04:01:30 INFO 2021-11-08 04:01:30 DEBUG [DB] Updated user 1 2021-11-08 04:01:30 INFO [adts @ 0x7f1a5bcb43c0] Scalable configurations are not allowed in ADTS 2021-11-08 04:01:30 INFO Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input 2021-11-08 04:01:30 INFO Error initializing output stream 0:0 -- 2021-11-08 04:01:30 INFO 2021-11-08 04:01:30 INFO 2021-11-08 04:01:30 ERROR Ffmpeg Err ffmpeg exited with code 1: Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input Error initializing output stream 0:0 --`
deekerman 2026-02-20 00:16:23 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@advplyr commented on GitHub (Nov 8, 2021):

I'm still learning as I go when it comes to audio transcoding and streaming, so I need to be able to reproduce this on my end.
Are you able to get me an audio file to test with?

@advplyr commented on GitHub (Nov 8, 2021): I'm still learning as I go when it comes to audio transcoding and streaming, so I need to be able to reproduce this on my end. Are you able to get me an audio file to test with?
Author
Owner

@BLuR457 commented on GitHub (Nov 8, 2021):

Sure. Here is a link. It might be a size thing with .m4b files. I've converted about 6 books to .mb4 and the ones that work are all under 500MB. I'll convert some more and get back with you.

@BLuR457 commented on GitHub (Nov 8, 2021): Sure. [Here is a link.](https://1drv.ms/u/s!AqYGc-_0shFXiQcUtXsCoBBP18f0?e=O9DJhV) It might be a size thing with .m4b files. I've converted about 6 books to .mb4 and the ones that work are all under 500MB. I'll convert some more and get back with you.
Author
Owner

@BLuR457 commented on GitHub (Nov 8, 2021):

I converted all of my audiobooks to .m4b and books under 500MB work and books over don't. One book is 502 and doesn't work.

@BLuR457 commented on GitHub (Nov 8, 2021): I converted all of my audiobooks to .m4b and books under 500MB work and books over don't. One book is 502 and doesn't work.
Author
Owner

@advplyr commented on GitHub (Nov 13, 2021):

I have been investigating this issue and found someone who had the same issue: https://rentry.co/n4ost

They are "de-DRMed Audible AAX files" and you can see in FFMPEG where they added the error message that is getting thrown:
"Scalable configurations are not allowed in ADTS"
gitea.bjx.cloud/public/ffmpeg@496dcbbc86

In my tests I was able to generate the stream by forcing an encode to AAC, and according to that person who kindly outlined the error, Plex has found a way to catch this ahead of time and force the encode.

The lazy solution would be to catch this error, then fallback to forcing the encode.
The optimal solution would be to detect this before starting the stream.

@advplyr commented on GitHub (Nov 13, 2021): I have been investigating this issue and found someone who had the same issue: https://rentry.co/n4ost They are "de-DRMed Audible AAX files" and you can see in FFMPEG where they added the error message that is getting thrown: "Scalable configurations are not allowed in ADTS" https://gitea.bjx.cloud/public/ffmpeg/commit/496dcbbc86b679a3bc23421ed71a35ca1bb8fd9b In my tests I was able to generate the stream by forcing an encode to AAC, and according to that person who kindly outlined the error, Plex has found a way to catch this ahead of time and force the encode. The lazy solution would be to catch this error, then fallback to forcing the encode. The optimal solution would be to detect this before starting the stream.
Author
Owner

@advplyr commented on GitHub (Nov 13, 2021):

I implemented the lazy solution and released in v1.6.17.

Basically if the transcode fails with that error message and is AAC encodable, then it will fallback to encoding. This worked with the sample audiobook you sent me, but be warned it is a lot slower to get started.

Hopefully this workaround will suffice until a better solution comes along.

@advplyr commented on GitHub (Nov 13, 2021): I implemented the lazy solution and released in `v1.6.17`. Basically if the transcode fails with that error message and is AAC encodable, then it will fallback to encoding. This worked with the sample audiobook you sent me, but be warned it is a lot slower to get started. Hopefully this workaround will suffice until a better solution comes along.
Author
Owner

@BLuR457 commented on GitHub (Nov 15, 2021):

Thanks. I'll update later today.

@BLuR457 commented on GitHub (Nov 15, 2021): Thanks. I'll update later today.
Author
Owner

@openaudible commented on GitHub (May 18, 2022):

OpenAudible here. I just saw this and saw someone posted a write up of the problem and a possible fix (that requires changing a bit in the file..)
https://rentry.co/n4ost
Might try to find some sample files and see if I can reproduce or fix. Would be nice if the bad bit doesn't get propagated.

@openaudible commented on GitHub (May 18, 2022): OpenAudible here. I just saw this and saw someone posted a write up of the problem and a possible fix (that requires changing a bit in the file..) https://rentry.co/n4ost Might try to find some sample files and see if I can reproduce or fix. Would be nice if the bad bit doesn't get propagated.
Author
Owner

@advplyr commented on GitHub (May 18, 2022):

I came across that writeup too https://github.com/advplyr/audiobookshelf/issues/172#issuecomment-968064121
Very useful

@advplyr commented on GitHub (May 18, 2022): I came across that writeup too https://github.com/advplyr/audiobookshelf/issues/172#issuecomment-968064121 Very useful
Author
Owner

@wchargin commented on GitHub (Jan 5, 2025):

I found this thread while troubleshooting a similar issue. An audiobook made of many small m4b files worked fine, but an audiobook with one large, chapterized m4b file (of similar total size) could not be scanned.

In my journalctl -u audiobookshelf logs, I saw a reference to a scan log, which included the message:

Library item at path "[xxx]" has no audio files and no ebook file - ignoring

I checked that the m4b file was actually playable in VLC, and it was. So I tried running ffprobe on it, using the binary at /usr/share/audiobookshelf/ffprobe. This quickly printed Killed: it was being killed by the Linux OOM killer. This makes some sense, since my Audiobookshelf instance was running on a small DigitalOcean droplet with 512 MB of RAM.

(Additionally, sometimes pressing "Scan" would crash the Audiobookshelf service itself, and it would be restarted by systemd.)

I upgraded my droplet to 2 GB of RAM, and scanned again. This time, it picked up the file and added the library item, and I can play it without problems.

Thank you for Audiobookshelf! I am happy with it so far.

@wchargin commented on GitHub (Jan 5, 2025): I found this thread while troubleshooting a similar issue. An audiobook made of many small m4b files worked fine, but an audiobook with one large, chapterized m4b file (of similar total size) could not be scanned. In my `journalctl -u audiobookshelf` logs, I saw a reference to a scan log, which included the message: > Library item at path "[xxx]" has no audio files and no ebook file - ignoring I checked that the m4b file was actually playable in VLC, and it was. So I tried running `ffprobe` on it, using the binary at `/usr/share/audiobookshelf/ffprobe`. This quickly printed `Killed`: it was being killed by the Linux OOM killer. This makes some sense, since my Audiobookshelf instance was running on a small DigitalOcean droplet with 512 MB of RAM. (Additionally, sometimes pressing "Scan" would crash the Audiobookshelf service itself, and it would be restarted by systemd.) I upgraded my droplet to 2 GB of RAM, and scanned again. This time, it picked up the file and added the library item, and I can play it without problems. Thank you for Audiobookshelf! I am happy with it so far.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/audiobookshelf#90
No description provided.