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

[Enhancement]: Configurable bitrate for m4b-merge #1029

Closed
heikomat opened this issue Oct 2, 2022 · 6 comments
Closed

[Enhancement]: Configurable bitrate for m4b-merge #1029

heikomat opened this issue Oct 2, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@heikomat
Copy link

heikomat commented Oct 2, 2022

Describe the feature/enhancement

I'd love to have a little control over the quality of the files generated via the awesome m4b merge feature.

I usually use Apple music to convert my Audiobook-CDs to M4A-Files using its AAC-encoder. As i understand it, m4b also uses AAC, so i guess their bitrate-to-quality-ratios are probably comparable? If so, the default 64 kbps used in audiobookshelf might be a little low for some scenarios.

I do understand that for most cases it's probably fine (and even desirable considering space- and bandwitdh-savings). But i do really like hearing the incredible detail (especially in the highs) that some recordings have when listened to on a somewhat nice pair of headphones.

Because space and bandwidth are not an issue for me, I usually set my AAC-encoding-bitrate to (maybe a tad overkill? maybe not?) 192 kbps and would love to be able to do the same in audiobookshelf.

@heikomat heikomat added the enhancement New feature or request label Oct 2, 2022
@andrewls
Copy link

andrewls commented Oct 3, 2022

Another alternative to this would be to set the target bitrate based on the codec and bitrate of the source files. Encoding at 192kbps AAC makes no sense if your source file is a 64kbps mp3

@mobywan85
Copy link

Where in the codebase is the bitrate set? I would love to be able to manually just change it?

@advplyr
Copy link
Owner

advplyr commented Nov 16, 2022

I haven't dug into this yet but I think @andrewls has the right approach in using the bitrate of the source file.

Abs also supports merging multiple m4b's using this tool and for that it should already be maintaining the bitrate since no encoding is required.

Here it is in the codebase where the options are set for ffmpeg. 64k is hardcoded at the moment and as a temp solution can be increased for the next release.

https://github.com/advplyr/audiobookshelf/blob/master/server/managers/AbMergeManager.js#L107

As it is now Abs is already attempting to get the bitrate from audio files when they are scanned. Most likely this is not going to be the case in the future because we are switching to Tone library which will only be extracting meta tags. For that reason we should have the merge tool first do an ffprobe on one of the mp3s to get the source bitrate.

@advplyr
Copy link
Owner

advplyr commented Nov 16, 2022

I'm wondering what ffmpeg will output if we set the default bitrate higher then the source bitrate.

@Alcedema
Copy link

Alcedema commented Nov 27, 2022

I also came on here to ask for customisable bitrate, but yes, ffprobe on encode start to set a bit rate comparable to the source would be best! Thanks!

@advplyr advplyr added the awaiting release Issue is resolved and will be in the next release label Dec 19, 2022
@advplyr
Copy link
Owner

advplyr commented Dec 19, 2022

Added in v2.2.11

This is just a quick and dirty implementation so you can adjust these settings. Will leave further updates to encoding options for #1257

image

@advplyr advplyr closed this as completed Dec 19, 2022
@advplyr advplyr removed the awaiting release Issue is resolved and will be in the next release label Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants