Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Parts/Chapters again? #215

Open
jpretori opened this issue Apr 15, 2022 · 6 comments
Open

Parts/Chapters again? #215

jpretori opened this issue Apr 15, 2022 · 6 comments

Comments

@jpretori
Copy link

I found #184 and thought it would solve my problem, so I pulled the latest code and tried again.

Unfortunately I still get only 4 mp3 files when I try to convert asin B088C4DBYP. The total output is about 4 MB, while the AAXC file is nearly 1GB.

Here is my commandline:

$ AAXtoMP3/AAXtoMP3 --authcode 1568f10a --target_dir test --use-audible-cli-data --chaptered aax/Heavens_River_Bobiverse_Book_4-AAX_44_128.aaxc

In case it helps, here's the json file too (as a .txt because Github won't allow .json files).
Heavens_River_Bobiverse_Book_4-chapters.json.txt

@faaarmer
Copy link

I'm having the same problem - maybe it's nested chapters?

@faaarmer
Copy link

faaarmer commented Apr 23, 2022

There's a fix for nested chapters, but other stuff is broken on the master branch for me. So I manually flattened the chapters.json

@jpretori
Copy link
Author

I went ahead and did the manual flattening thing. In case it helps anyone else, here's the structure.

This represents a single chapter nested inside a "part". The offset and length of the "Part" is recorded after the chapter. This is the piece of the book where the reader says something like "Part eight". It's very short, and its starting offset is before the chapter above it.

                {
                    "chapters": [
                        {
                            "length_ms": 436832,
                            "start_offset_ms": 59056591,
                            "start_offset_sec": 59057,
                            "title": "8.1 TO BOLDLY GO"
                        }
                    ],
                    "length_ms": 3000,
                    "start_offset_ms": 59053591,
                    "start_offset_sec": 59054,
                    "title": "8"
                }

To flatten it out, move the "Part" stuff into curly braces and put it before the chapter. I don't know if the order matters or not, but it worked for me.

Like so:

                    "chapters": [
                        {
                    "length_ms": 3000,
                    "start_offset_ms": 59053591,
                    "start_offset_sec": 59054,
                    "title": "8"
                        },
                        {
                            "length_ms": 436832,
                            "start_offset_ms": 59056591,
                            "start_offset_sec": 59057,
                            "title": "8.1 TO BOLDLY GO"
                        }

@jpretori
Copy link
Author

jpretori commented Jul 2, 2022

I found a simpler manual way. Just delete the extra sections like in the screenshot... then re-run AAXtoMP3. It looks like it then converts the whole book. Maybe at some point I'll figure out jq syntax enough to suggest a change that does this as part of the main script.

2022-07-02_scrot

@j2L4e
Copy link

j2L4e commented Jul 6, 2022

Here you go (https://jqplay.org/s/nGtqx7eMzsm):

[.content_metadata.chapter_info | .. | arrays[] | del(.chapters)] | sort_by(.start_offset_ms)

find all arrays within chapter_info recursively, delete the nested "chapters" arrays, then sort the chapters by offset

@joergister
Copy link

Had the same problem, the following worked for me:

  • ./audible download --all --aaxc --cover --cover-size 1215 --chapter

  • For audiobooks having chapter and Parts i had to flatten the chapter.json file with the script @jpretori provided (thx a lot btw., really helped me a lot. The filter @j2L4e provided caused an errror though

  • converted the .aaxc to .m4b while separating into multiple files each representing a chapter/Part and and having their respective chapter/Part name as file name while also each having a number/index bash AAXtoMP3 -e:m4b -c -D 'Audiobooks/$title ($narrator)' --use-audible-cli-data *.aaxc

  • Merged all the files with https://github.com/gonzoua/AudioBookBinder (also available in the Appstore https://apps.apple.com/us/app/audiobook-binder/id413969927?mt=12 ) into one .m4b file, each file becomes a separate chapter. Multiple Files can be joined to be one chapter if wanted as described here http://bluezbox.com/audiobookbinder/chapters.html

  • Files that only have chapters not parts aswell aka no "multilevel chapters" work just fine without the flattening.

A little heads up for anyone also using audiobook-binder: default setting is to not create files longer then 12hrs. I recomend setting this to infinity because having the whole book in one file is a lot more convinient then having 2-3 separate files to deal with. Also the quality is set to 128kbps which is a lot for just voice in AAC, what can be lowered quite a bit withough noticable loss of qualitly

I wonder though if it is possible to use audible-cli data for chapters while outputting only to one file? because when i remove the -c from this bash AAXtoMP3 -e:m4b -c -D 'Audiobooks/$title \($narrator\)' --use-audible-cli-data *.aaxci get ERROR: Unable to parse time code from "00:00:0,000"and im not quite sure what i did wrong. Im under the impression, that this should no longer cut into multiple files while still using the data for chapters provided by audible-cli but i might be wrong about that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants