Comments (3)
Personally, I use this commande in my script to detect bitrate :
bit=$(ffprobe -hide_banner -loglevel 0 -of flat -i "$sample" -select_streams a -show_entries format=bit_rate -of default=noprint_wrappers=1:nokey=1)
where "$sample" is the first file of the audiobook.
Then i set the bitrate in the merge function :
m4b-tool merge "$folder" -n --audio-bitrate="$bit" [...]
from m4b-tool.
You are absolutely correct. Unfortunately this is not as trivial as it may seem.
In the past I had to rely on ffmpeg
for bitrate and this was not accurate.
With tone
the bitrate detection is pretty accurate now but vbr
values probably must be handled differently and this is tricky. Different formats also may have different quality on different bitrates, so a conversion from 64kbit aac
to 96kbit mp3
could make sense under specific circumstances.
Moreover the comparison has to be done per FILE not per BOOK, because every source file could have different quality. So if you have a 320k book with one file of 64k the limit as a whole would be 64k or I would have to build an average quality value, where I measure every file, sum it up and divide it by the number of files. That would be possible, but still a bit inaccurate. There is also the sampling rate, etc. etc.
However, we don't wanna have a perfect solution, so what I could do is a simple value comparison like this:
if ($sourceBitrate < $destinationBitrate) {
$destinationBitrate = $sourceBitrate;
$destinationSamplingRate = findAccordingSamplingRate($destinationBitrate);
}
or as mentioned the average approach
$sourceAvgBitrate = buildAverageBitrate($sourceFiles);
if($destinationBitrate > $sourceAvgBitrate) {
$destinationBitrate = $sourceAvgBitrate;
$destinationSamplingRate = findAccordingSamplingRate($destinationBitrate);
}
when a flag (e.g. --no-upscaling
) is given. We could also introduce an integer value to be more flexible (e.g. --max-upscaling=32000
) where it would upscale 64k to 96k but not higher. A value of 0 would have the same effect as the flag, a negative value could also be used to limit the downscaling to a specific value.
Which one would you prefer?
from m4b-tool.
I'm not an expert in encoding. I just want to pack my books into a handy container with cover, chapters and bookmarks. So in my cases what I do is pretty straigh forward - I get the maximum bitrate from vbr mp3's of book and convert the whole book in this bitrate according this rule: 64/mp3 to 32/aac, 128 to 64, all other to 96
--max-upscaling
with 0 value will be the good compromise for me.
Ability of setting the appropriate output format for the input format would be ideal, but this solution may not be perfect for everyone else.
P.S.
I'm sorry for my English. I hope you'll get the point.
from m4b-tool.
Related Issues (20)
- Not adding metadata to the output file HOT 6
- How do you set tags as chapter names? HOT 2
- ffmpeg version 4.0.0 or higher is required HOT 9
- Implicit conversion from float to int loses precision (Parser/SilenceParser.php line 61) HOT 1
- Return type of M4bTool\Audio\Tag::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used HOT 6
- [FeatureRequest] Flag to copy all tags HOT 3
- Anyway to merge and use individual .mp3 filenames as chapter titles? HOT 2
- MusicBrainz HTTP 404 HOT 1
- podman permission denied error. suggested alias for running m4b-tool with podman HOT 1
- check --output-file is writeable before doing a processing job HOT 1
- Cannot build pre-release HOT 3
- mp4v2 HOT 2
- Chapter names are not being setup correctly. HOT 5
- Deprecation warnings running php v8? HOT 9
- Having images or text files in an intermediate directory for batch processing can lead to unexpected results HOT 1
- Docker: PHP Permissions Denied Error on Rename HOT 5
- uncaught exception: The provided cwd "" does not exist.Finished Converting HOT 1
- No option to disable silence detection HOT 1
- Cannot extract chapters HOT 12
- Call to a member function getStart() on array HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m4b-tool.