Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read bookmarks from m4b files #185

Open
siffland opened this issue Dec 30, 2017 · 6 comments

Comments

@siffland
Copy link

commented Dec 30, 2017

I have a bunch of audio books, mostly from downpour.com, in the .m4b file format. They do offer in mp3, but books tend to have 50-100 mp3 files instead of the 1 to 3 m4b files, with chapters/bookmarks. Logitech Media Server plays the m4b files correctly, but it would be nice if they could read the metadata and group the m4b files together and also parse the chapters. from what i can tell chapters/bookmarks is what separates m4b from m4a. This would be a nice enhancement i think.

thanks,
sean

@mherger

This comment has been minimized.

Copy link
Contributor

commented Jan 4, 2018

I think you should get in touch with @andygrundman about adding support for this in his Audio::Scan module (https://github.com/andygrundman/Audio-Scan).

@andygrundman

This comment has been minimized.

Copy link
Contributor

commented Jan 4, 2018

Audio-Scan could probably support parsing the additional mp4 box types used by m4b files and provide them as part of the tag data. I'd be ok adding this as long as there is a good spec document to work from for these additional box types.

Most of the work would be in the LMS plugin side, I think. You'd want something that treats this chapter metadata like an embedded cue sheet with virtual tracks. m4b also supports storing the current play position within the file itself, which sounds like a very important feature. LMS can't modify files, that's a core principle, and there's no tag writing support anyway, so you'd have to implement saving the position another way... I feel like there must be a plugin that has implemented this for podcasts somehow, right?

But this might be one area where it's time to embrace the future and use Alexa/Kindle. The only audio books I own just live in my Kindle library and if I wanted to listen to them I'd just ask Alexa. Kindle's integration is pretty neat, it tracks progress in both the text and audio versions together, so you can switch between them. There's no way LMS can compete with this unfortunately.

@siffland

This comment has been minimized.

Copy link
Author

commented Jan 5, 2018

I am trying to see if i can find any spec documents on the m4b, but my google skills are failing. The following document has detailed information on the m4a (on page 67), but i don't think it is was you are looking for.

http://sourceforge.net/projects/audiotools/files/audio%20formats%20reference/2.14/audioformats_2.14_letter.pdf/download

yeah i have audible on my phone and a few books there, but mostly they are just the m4b from DRM free sites. I just like the DRM free stuff offline for when i need it. It has been cold here and we lost internet a few times, LMS works great still.

Sean

@LazaRocks

This comment has been minimized.

Copy link

commented Jan 10, 2018

I am not sure if I undestood correctly, but if Andy is asking for specs for MP4,
I've found in (Ref 1) of
https://en.wikipedia.org/wiki/MPEG-4_Part_14

this:
https://web.archive.org/web/20091007071048/http://www.3gpp2.org/Public_html/specs/C.S0050-B_v1.0_070521.pdf

There are some open source projects doing the conversion from .mp3 to .m4b too, but I am not sure if that is what Andy needs.

Cheers,
L.

@DarkShortie

This comment has been minimized.

Copy link

commented Aug 27, 2019

I'm also interested in the part of adding m4b to my library and use the included chapters. Storing the position is not needed in the file.

I had a look into my m4b files, it seems we have to parse the chpl atom with "Nero" chapters like described here: https://github.com/Zeugma440/atldotnet/wiki/Focus-on-Chapter-metadata

I've already started a bit fiddling around in Audio::Scan and I tried to add a small parser for chpl already.
At first I've started with a file which doesn't have chapter titles. But now I'm stuck, the error I get is:
buffer_get_ret: trying to get more bytes 8 than in buffer 4 at CPAN/Audio/Scan.pm line 64. buffer_get_int64_le: buffer error at CPAN/Audio/Scan.pm line 64.
I've already checked rsize which is 1341. If I subtract 9 bytes (1 version, 3 flags, 1 reserved, 4 count) and divide it by 148 (number of chapters in this file) I get a size of 9. So this should be totally fine (8 Byte chapter start time, 1 Byte number of bytes for the title which is not set in this file).
The same happens with different files, but at different locations.

Can someone give me a hint why this happens? @andygrundman?

Update: Got it after digging deeper into buffer.c. I've to use _check_buf() first which will increase the buffer to rsize if possible. Now I get the values and can continue ;)

@andygrundman

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2019

Glad you got it to work, the buffer can be tricky. Uncommenting #define AUDIO_SCAN_DEBUG at the top of include/common.h can be helpful for debugging buffer-related issues. If you need more help, send me the github link to your fork and I am happy to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.