m4b-tool
是ffmpeg
和mp4v2
的包装器,用于合并、拆分或操作带有章节的有声读物文件。虽然m4b-tool
旨在处理 m4b 文件,但几乎所有音频格式都应支持,例如 mp3、aac、ogg、alac 和 flac。
如果您正在使用我的任何项目并发现它们有帮助,请考虑捐赠以支持我。我计划用这笔钱来支持其他开源项目或慈善目的。谢谢你!
>= 25.00$
特别感谢所有每月捐赠金额>= 25.00$
的赞助商。
姓名 | 数量 |
---|---|
努米尼特 | 25.00$ |
获取 Nix 并确保启用 Flakes。
nix run github:sandreas/m4b-tool
或nix run github:sandreas/m4b-tool#m4b-tool-libfdk
nix build github:sandreas/m4b-tool
或nix build github:sandreas/m4b-tool#m4b-tool-libfdk
./result/bin/m4b-tool
nix develop
composer2nix --executable --composition=composer.nix
来更新 .nix 文件我开始了一个实验,现在已经达到了早期的 alpha 水平,可以试用了。该命令行工具是用C#
编写的,完全开源,名为tone
。它已经有一个相当不错的功能集,所以如果你想尝试一下,这里是:
https://github.com/sandreas/tone
此公告并不意味着m4b-tool
已被弃用或很快就会被弃用。 m4b-tool
的开发将会继续(至少直到tone 具有与m4b-tool
类似的功能集)。只是为了提供一个替代工具来实现可能有局限性的功能。
玩得开心,迫不及待地想得到您的反馈。
不幸的是我现在很忙,所以m4b-tool 0.4.2
已经很旧了。由于不打算在没有完整文档的情况下发布新版本,因此只有最新的预发布版本修复了错误。它已经相当稳定,因此如果您在v0.4.2
中遇到错误,请尝试最新的预发行版(如果它已被修复)。
谢谢你,桑德里亚斯
https://pilabor.com
merge
到单个 m4b 文件中split
为多个输出文件,或通过提示表将flac
编码专辑拆分为单个曲目chapters
将目录data/my-audio-book
中的所有音频文件merge
到文件data/merged.m4b
(保留标签并嵌入data/my-audio-book/cover.jpg
和data/my-audio-book/description.txt
,如果有的话)
m4b-tool merge "data/my-audio-book/" --output-file="data/merged.m4b"
将一个大 m4b 文件按章节split
为多个 mp3 文件,位于data/my-audio-book_splitted/
(如果 m4b 包含封面,则保留标签,创建data/my-audio-book_splitted/cover.jpg
)
m4b-tool split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "data/my-audio-book.m4b"
chapters
可以尝试通过静音检测来调整 m4b 的现有章节
m4b-tool chapters --adjust-by-silence -o "data/destination-with-adjusted-chapters.m4b" "data/source-with-misplaced-chapters.m4b"
由于m4b-tool
最常用的子命令似乎是merge
,我们来谈谈最佳实践......
不幸的是m4b-tool
有很多依赖项。不仅仅是单行,如果您想获得最好的质量和标记支持,许多依赖项必须使用额外的选项手动编译。这就是为什么你应该看看 docker 镜像,它具有顶级音频质量、顶级标记支持和易于安装的所有功能,而且几乎没有任何缺点。
注意:如果你在Windows上,可能很难让它工作
合并有声读物时,您应该准备它们 - 即使您只合并一本有声读物,以下目录结构也会有很大帮助:
input/<main genre>/<author>/<title>
或者如果它是一个系列
input/<main genre>/<author>/<series>/<series-part> - <title>
示例:
input/Fantasy/J.K. Rowling/Quidditch Through the Ages/
input/Fantasy/J.K. Rowling/Harry Potter/1 - Harry Potter and the Philosopher's Stone/
注意:如果您的有声读物标题包含无效的路径字符,例如
/
,只需将它们替换为破折号-
。
现在,因为您几乎总是想要有声读物的封面和描述,所以您应该在主目录中添加以下文件:
cover.jpg
(或cover.jpeg
或cover.png
)description.txt
(请确保内容使用UTF-8
文本文件编码)示例:
input/Fantasy/J.K. Rowling/Quidditch Through the Ages/cover.jpg
input/Fantasy/J.K. Rowling/Quidditch Through the Ages/description.txt
注意:
m4b-tool
将自动查找并嵌入这些文件,但如果它们不存在也不会失败
章节很适合为您的有声读物添加路径点。它们有助于记住最后的位置并改善总体体验。
如果您想手动调整章节,可以添加包含以下内容的chapters.txt
(与cover.jpg
相同的位置)( <chapter-start>
<chapter-title>
):
00:00:00.000 Intro
00:04:19.153 This is
00:09:24.078 A way to add
00:14:34.500 Chapters manually
如果您的输入文件已标记,这些标记将用于按title
创建章节元数据。因此,如果您使用有效的章节名称标记输入文件作为曲目title
,这将产生一个漂亮且干净的m4b
文件,其中包含有效的章节名称。
自m4b-tool
v.0.4.0以来的另一个重要功能是--max-chapter-length
参数。通常,单个输入文件太大,导致章节持续时间很长。如果您想跳到某个点,这可能会很烦人,因为您必须倒回或快进并按住按钮很长时间,而不是只向前或向后倾斜几次。要自动添加子章节,您可以提供:
--max-chapter-length=300,900
这将导致m4b-tool
子章节的命名与原始章节相同,并有一个额外的索引。这是保留真实姓名但又避免章节持续时间过长的好方法。
如果您拥有 iPod,则可能会出现有声读物太长的问题,因为 iPod 仅支持 32 位采样率。如果您的有声读物在 22050Hz 采样率下长度超过 27 小时,您可以提供--adjust-for-ipod
来自动对有声读物进行下采样,这会导致质量较低,但至少它可以在您的旧 iPod 上运行...
m4b-tool
支持与--jobs
参数并行的多个转换任务(例如--jobs=2
)。如果您必须转换多个文件(这是常见的情况),则通过提供--jobs=2
参数(或者如果您有四核系统等,则使用--jobs=4
进行四份转换)可将合并速度提高近一倍.)。不要提供高于系统核心数量的数字 - 这会减慢合并速度...
注意:如果在所有核心上运行转换,将导致 CPU 使用率几乎 100%,这可能会导致系统性能变慢
--batch-pattern
功能在m4b-tool v.0.4.0
中添加了--batch-pattern
功能。它可用于一次批量转换多本有声读物,也可用于仅转换一本有声读物 - 因为您可以从现有目录结构创建标签。
提示:使用
--batch-pattern
时,output-file
参数必须是目录。
甚至支持多个--batch-pattern
参数,而第一个匹配将首先使用。因此,如果您按照上述方式创建了目录结构,则最终命令将input/Fantasy/Harry Potter/1 - Harry Potter and the Philosopher's Stone/
合并到output/Fantasy/Harry Potter/1 - Harry Potter and the Philosopher's Stone.m4b
看起来像这样:
m4b-tool merge -v --jobs=2 --output-file="output/" --max-chapter-length=300,900 --adjust-for-ipod --batch-pattern="input/%g/%a/%s/%p - %n/" --batch-pattern="input/%g/%a/%n/" "input/"
在
--batch-pattern
模式下,默认情况下会跳过现有文件
如果您使用 docker 映像执行上述步骤或安装并编译了所有依赖项,您应该得到以下结果:
libfdk_aac
编码器提供最高品质的音频--batch-pattern
用法的genre
、 author
、 title
、 sorttitle
等有效标签cover.jpg
(或cover.jpeg
或cover.png
)和description.txt
,则会嵌入cover
、 description
和longdesc
要将 docker 与m4b-tool
一起使用,您首先必须
pull
官方docker镜像(推荐)build
Dockerfile
官方docker 镜像可在 DockerHub 上获取。它们在某种程度上是实验性的,但已被证明运作良好。 latest
标签被认为是与前沿功能和修复相结合的方式。时不时地会发布一个带有日期的标签(例如sandreas/m4b-tool:2022-09-25
),这被认为是相当稳定的,以确保损坏的latest
图像不会破坏您的整个设置。
# pull the image
docker pull sandreas/m4b-tool:latest
# create an alias for m4b-tool running docker
alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt sandreas/m4b-tool:latest'
# testing the command
m4b-tool --version
注意:如果您使用上面的别名,请记住您不能使用绝对路径(例如
/tmp/data/audiobooks/harry potter 1
)或符号链接。您必须更改到目录并使用相对路径(例如cd /tmp/data && m4b-tool merge "audiobooks/harry potter 1" --output-file harry.m4b
)
要为特定的m4b-tool
版本手动构建 docker 容器,需要提供额外的参数来将特定版本下载到映像中,例如v.0.4.1
:
# clone m4b-tool repository
git clone https://github.com/sandreas/m4b-tool.git
# change directory
cd m4b-tool
# build docker image - this will take a while
docker build . -t m4b-tool
# create an alias for m4b-tool running docker
alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt m4b-tool'
# testing the command
m4b-tool --version
# use the specific pre-release from 2022-07-16
docker build . --build-arg M4B_TOOL_DOWNLOAD_LINK=https://github.com/sandreas/m4b-tool/files/9125095/m4b-tool.tar.gz -t m4b-tool
注意:您也可以只编辑
Dockerfile
中的相应变量。
开发人员或专家可能希望运行m4b-tool
的完整自定义构建或自己构建代码(例如,如果您分叉了存储库并应用了一些补丁)。如果是这种情况,您可以将自定义构建存储到与Dockerfile
相关的dist/m4b-tool.phar
,然后执行默认构建。
# dist/m4b-tool.phar is available
docker build . -t m4b-tool
之后,自定义构建应该集成到 docker 镜像中。
在 MacOS 上,您可以使用很棒的包管理器brew
来安装m4b-tool
。
获得最佳音频质量需要一些额外的努力。您必须使用非自由的libfdk_aac
编解码器重新编译ffmpeg
。这需要卸载默认的ffmpeg
包(如果已安装),因为brew
放弃了额外选项的可能性。没有官方的ffmpeg-with-options
存储库,但有一个相当不错的tap
,您可以使用它来节省时间。
# FIRST INSTALL ONLY: if not already done, remove existing ffmpeg with default audio quality options
# check for ffmpeg with libfdk and uninstall if libfdk is not already available
[ -x "$(which ffmpeg)" ] && (ffmpeg -hide_banner -codecs 2>&1 | grep libfdk || brew uninstall ffmpeg)
# tap required repositories
brew tap sandreas/tap
brew tap homebrew-ffmpeg/ffmpeg
# check available ffmpeg options and which you would like to use
brew options homebrew-ffmpeg/ffmpeg/ffmpeg
# install ffmpeg with at least libfdk_aac for best audio quality
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac
# install m4b-tool
brew install sandreas/tap/m4b-tool
# check installed m4b-tool version
m4b-tool --version
如果上述方法不适合您,或者您只想在生产中使用m4b-tool
之前检查一下,您可能想尝试快速而简单的方法。它可以工作,但你会得到较低的音频质量,并且不支持排序标记。
# tap m4b-tool repository
brew tap sandreas/tap
# install dependencies
brew install ffmpeg fdk-aac-encoder mp4v2
# install m4b-tool with acceptable audio quality and no sort tagging
brew install --ignore-dependencies sandreas/tap/m4b-tool
# install all dependencies
sudo apt install ffmpeg mp4v2-utils fdkaac php-cli php-intl php-json php-mbstring php-xml
# install / upgrade m4b-tool
sudo wget https://github.com/sandreas/m4b-tool/releases/download/v.0.4.2/m4b-tool.phar -O /usr/local/bin/m4b-tool && sudo chmod +x /usr/local/bin/m4b-tool
# check installed m4b-tool version
m4b-tool --version
注意:如果您想获得最佳的音频质量,则必须使用高质量编码器
fdk-aac
(--enable-libfdk_aac
) 编译ffmpeg
- 请参阅 https://trac.ffmpeg.org/wiki/CompilationGuide/ Ubuntu 获取编译ffmpeg
的分步指南。
m4b-tool
用PHP
编写,并使用ffmpeg
、 mp4v2
和可选的fdkaac
来实现高效编解码器来执行转换。因此,您的 %PATH% 中需要以下工具:
php
>= 7.1,启用mbstring
扩展 (https://php.net)ffmpeg
(https://www.ffmpeg.org)mp4v2
( mp4chaps
、 mp4art
等 https://github.com/sandreas/m4b-tool/releases/download/v0.2/mp4v2-windows.zip)fdkaac
(可选,仅当您需要低比特率 <= 32k 的高效率时,http://wlc.io/2015/06/20/fdk-aac/ - 警告:非官方!)要检查依赖关系,通过命令行运行以下命令应显示类似的输出:
$ php -v
Copyright (c) 1997-2018 The PHP Group [...]
$ ffmpeg -version
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers [...]
$ mp4chaps --version
mp4chaps - MP4v2 2.0.0
$ fdkaac
fdkaac 1.0.0 [...]
如果您确定已安装所有依赖项,下一步是从下载最新版本的m4b-tool
https://github.com/sandreas/m4b-tool/releases
根据操作系统,您可以将m4b-tool.phar
重命名为m4b-tool
并直接从命令行运行m4b-tool --version
。如果您不确定,可以随时使用命令php m4b-tool.phar --version
检查安装是否成功。这应该适用于每个系统。
如果您想使用包含所有新功能和修复的最新源代码,您也可以从源代码构建。当前版本可能不稳定,只能用于测试目的,或者如果您需要尚未发布的特定功能。
mp4v2
以实现准确的排序顺序大多数有声读物并不是按字母顺序发布的。一个突出的例子是《哈利·波特》。因此,如果您拥有所有《哈利·波特》有声读物,这取决于您的播放器,但可能它们没有按正确的顺序列出...让我们看看字母顺序是什么:
正确的顺序是:
嗯,有一个解决方案。您必须使用自定义sortname
和/或sortalbum
标记有声读物。如果您的播放器支持这些标签,则即使标题仍然是原始标题,顺序现在也是正确的。为了实现这一目标,我必须构建一个自定义版本的mp4v2
(更准确的mp4tags
),为这些标签添加选项并添加伪标签--series
和--series-part
。
因此,如果您执行以下操作:
m4b-tool merge --name="Harry Potter and the Chamber of Secrets" --series="Harry Potter" --series-part="2" --output-file="output/Harry Potter and the Chamber of Secrets.m4b" "input/Harry Potter and the Chamber of Secrets"
这将导致:
Harry Potter and the Chamber of Secrets
Harry Potter 2 - Harry Potter and the Chamber of Secrets
mp4v2
在docker镜像中,已经安装了自定义版本
git clone https://github.com/sandreas/mp4v2
cd mp4v2
./configure
make && sudo make install
在m4b-tool
中,所有音频转换均使用ffmpeg
执行,使用其免费编码器产生相当下降的音频质量。然而,最好的质量需要一些额外的努力,因此如果您使用免费编码器, m4b-tool
可能会显示以下提示:
您的 ffmpeg 版本无法使用编码器 aac 而不是 libfdk_aac 生成高质量的 aac
这并不是真正的问题,因为aac
和libfdk_aac
编码器之间的差异在大多数情况下几乎不明显。但为了克服这个提示并获得尽可能最好的音频质量,您必须使用非自由编码器,默认情况下该编码器未集成在ffmpeg
中(许可原因)。根据您使用的操作系统,安装非自由编码器可能需要一些额外的技能、精力和时间(请参阅上面针对您的操作系统的注释)。您必须决定是否值得付出额外的努力来获得稍微好一点的质量。如果您使用 docker 映像,则默认情况下应该获得最佳质量。
如果您使用非常低的比特率(<= 32k),您还可以使用高效率配置文件来进一步提高音频质量(例如,单声道的--audio-profile=aac_he
)。不幸的是, ffmpeg
的高效实现生成的音频文件与许多播放器(包括 iTunes)不兼容。为了生成至少与大多数常见播放器兼容的高效文件,您现在需要安装fdkaac
。
更多详情:
您认为m4b-tool
有问题吗?首先看一下下面的已知问题。如果这没有帮助,请在添加问题时提供以下信息:
m4b-tool merge my-audio-book/ --output-file merged.m4b
the resulting file merged.m4b is only 5kb
例子:
Title: m4b-tool does not embed covers
If i run m4b-tool with a folder containing a cover.png, it does not embed the cover and shows an error message.
OS: Ubuntu 16.04 LTS
Command: `m4b-tool merge my-audio-book/ ---output-file merged.m4b`
Error: Cannot embed cover, cover is not a valid image file
Attached files: cover.png
如果您遇到 PHP 异常,大多数情况下是 PHP 的配置问题。如果不熟悉 PHP 配置,您可以按照以下说明修复一些已知问题:
[Exception]
charset windows-1252 is not supported - use one of these instead: utf-8
这主要发生在 Windows 上,因为mbstring
-Extension 用于内部转换字符集,因此每个平台都支持特殊字符,例如德语变音符号。要解决此问题,您需要启用 mbstring-extension:
在命令行上运行php --ini
:
C:>php --ini
...
Loaded Configuration File: C:Program Filesphpphp.ini
在文本编辑器中打开配置文件(例如C:Program Filesphpphp.ini
)并搜索extension=
。在 Windows 上应该有一个像这样的项目:
;extension=php_mbstring.dll
删除;
启用扩展:
extension=php_mbstring.dll
现在一切都应该按预期进行。
以下列表包含所有可能的命令,包括merge
、 split
和chapters
以及每个命令中可用参数的参考。
使用m4b-tool
您可以将一组音频文件合并到一个 m4b 有声读物文件中。
m4b-tool merge "data/my-audio-book" --output-file="data/my-audio-book.m4b"
这会将文件夹data/my-audio-book
中的所有音频文件合并到my-audio-book.m4b
中,使用每个文件的标签标题来生成章节。
如果存在文件data/my-audio-book/cover.jpg
(或cover.jpeg
或cover.png
),它将用作生成的 m4b 文件的封面。
注意:如果您使用未标记的音频文件,您可以提供 musicbrainz id 来获取正确的章节名称,请参阅命令章节以获取更多信息。
有关所有选项,请参阅m4b-tool merge --help
:
Description:
Merges a set of files to one single file
Usage:
merge [options] [--] <input> [<more-input-files>...]
Arguments:
input Input file or folder
more-input-files Other Input files or folders
Options:
--logfile[=LOGFILE] file to log all output [default: ""]
--debug enable debug mode - sets verbosity to debug, logfile to m4b-tool.log and temporary encoded files are not deleted
-f, --force force overwrite of existing files
--no-cache clear cache completely before doing anything
--ffmpeg-threads[=FFMPEG-THREADS] specify -threads parameter for ffmpeg - you should also consider --jobs when merge is used [default: ""]
--platform-charset[=PLATFORM-CHARSET] Convert from this filesystem charset to utf-8, when tagging files (e.g. Windows-1252, mainly used on Windows Systems) [default: ""]
--ffmpeg-param[=FFMPEG-PARAM] Add argument to every ffmpeg call, append after all other ffmpeg parameters (e.g. --ffmpeg-param="-max_muxing_queue_size" --ffmpeg-param="1000" for ffmpeg [...] -max_muxing_queue_size 1000) (multiple values allowed)
-a, --silence-min-length[=SILENCE-MIN-LENGTH] silence minimum length in milliseconds [default: 1750]
-b, --silence-max-length[=SILENCE-MAX-LENGTH] silence maximum length in milliseconds [default: 0]
--max-chapter-length[=MAX-CHAPTER-LENGTH] maximum chapter length in seconds - its also possible to provide a desired chapter length in form of 300,900 where 300 is desired and 900 is max - if the max chapter length is exceeded, the chapter is placed on the first silence between desired and max chapter length [default: "0"]
--name[=NAME] custom name, otherwise the existing metadata will be used
--sortname[=SORTNAME] custom sortname, that is used only for sorting
--album[=ALBUM] custom album, otherwise the existing metadata for name will be used
--sortalbum[=SORTALBUM] custom sortalbum, that is used only for sorting
--artist[=ARTIST] custom artist, otherwise the existing metadata will be used
--sortartist[=SORTARTIST] custom sortartist, that is used only for sorting
--genre[=GENRE] custom genre, otherwise the existing metadata will be used
--writer[=WRITER] custom writer, otherwise the existing metadata will be used
--albumartist[=ALBUMARTIST] custom albumartist, otherwise the existing metadata will be used
--year[=YEAR] custom year, otherwise the existing metadata will be used
--description[=DESCRIPTION] custom short description, otherwise the existing metadata will be used
--longdesc[=LONGDESC] custom long description, otherwise the existing metadata will be used
--comment[=COMMENT] custom comment, otherwise the existing metadata will be used
--copyright[=COPYRIGHT] custom copyright, otherwise the existing metadata will be used
--encoded-by[=ENCODED-BY] custom encoded-by, otherwise the existing metadata will be used
--cover[=COVER] custom cover, otherwise the existing metadata will be used
--skip-cover skip extracting and embedding covers
--series[=SERIES] custom series, this pseudo tag will be used to auto create sort order (e.g. Harry Potter or The Kingkiller Chronicles)
--series-part[=SERIES-PART] custom series part, this pseudo tag will be used to auto create sort order (e.g. 1 or 2.5)
--audio-format[=AUDIO-FORMAT] output format, that ffmpeg will use to create files [default: "m4b"]
--audio-channels[=AUDIO-CHANNELS] audio channels, e.g. 1, 2 [default: ""]
--audio-bitrate[=AUDIO-BITRATE] audio bitrate, e.g. 64k, 128k, ... [default: ""]
--audio-samplerate[=AUDIO-SAMPLERATE] audio samplerate, e.g. 22050, 44100, ... [default: ""]
--audio-codec[=AUDIO-CODEC] audio codec, e.g. libmp3lame, aac, ... [default: ""]
--audio-profile[=AUDIO-PROFILE] audio profile, when using extra low bitrate - valid values: aac_he, aac_he_v2 [default: ""]
--adjust-for-ipod auto adjust bitrate and sampling rate for ipod, if track is too long (may result in low audio quality)
--fix-mime-type try to fix MIME-type (e.g. from video/mp4 to audio/mp4) - this is needed for some players to prevent an empty video window
-o, --output-file=OUTPUT-FILE output file
--include-extensions[=INCLUDE-EXTENSIONS] comma separated list of file extensions to include (others are skipped) [default: "aac,alac,flac,m4a,m4b,mp3,oga,ogg,wav,wma,mp4"]
-m, --musicbrainz-id=MUSICBRAINZ-ID musicbrainz id so load chapters from
--no-conversion skip conversion (destination file uses same encoding as source - all encoding specific options will be ignored)
--batch-pattern[=BATCH-PATTERN] multiple batch patterns that can be used to merge all audio books in a directory matching the given patterns (e.g. %a/%t for author/title) - parameter --output-file must be a directory (multiple values allowed)
--dry-run perform a dry run without converting all the files in batch mode (requires --batch-pattern)
--jobs[=JOBS] Specifies the number of jobs (commands) to run simultaneously [default: 1]
--use-filenames-as-chapters Use filenames for chapter titles instead of tag contents
--no-chapter-reindexing Do not perform any reindexing for index-only chapter names (by default m4b-tool will try to detect index-only chapters like Chapter 1, Chapter 2 and reindex it with its numbers only)
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--batch-pattern
的占位符参考如果使用--batch-pattern
参数,则支持以下占位符
title
/ name
: %n
sort_name
: %N
album
: %m
,sort_album
: %M
,artist
: %a
,sort_artist
: %A
,genre
: %g
,writer
: %w
,album_artist
: %t
,year
: %y
,description
: %d
,long_description
: %D
,comment
: %c
,copyright
: %C
,encoded_by
: %e
,group(ing)
: %G
,purchase_date
: %U
,series
: %s
,series_part
: %p
, m4b-tool
可用于通过提示表将单个m4b
拆分为每个章节的文件或将flac
编码的专辑拆分为单个曲目。
m4b-tool split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "data/my-audio-book.m4b"
这会将文件data/my-audio-book.m4b into
每个章节的 mp3 文件,并将文件写入data/my-audio-book_splitted/
。
如果您想分割包含多个曲目的flac
文件,则需要具有该flac
的确切文件名的提示表( my-album.flac
需要my-album.cue
):
# my-album.cue is automatically found and used for splitting
m4b-tool split --audio-format=mp3 --audio-bitrate=192k --audio-channels=2 --audio-samplerate=48000 "data/my-album.flac"
有关所有选项,请参阅m4b-tool split --help
:
Description:
Splits an m4b file into parts
Usage:
split [options] [--] <input>
Arguments:
input Input file or folder
Options:
--logfile[=LOGFILE] file to dump all output [default: ""]
--debug enable debug mode - sets verbosity to debug, logfile to m4b-tool.log and temporary files are not deleted
-f, --force force overwrite of existing files
--no-cache do not use cached values and clear cache completely
--ffmpeg-threads[=FFMPEG-THREADS] specify -threads parameter for ffmpeg [default: ""]
--platform-charset[=PLATFORM-CHARSET] Convert from this filesystem charset to utf-8, when tagging files (e.g. Windows-1252, mainly used on Windows Systems) [default: ""]
--ffmpeg-param[=FFMPEG-PARAM] Add argument to every ffmpeg call, append after all other ffmpeg parameters (e.g. --ffmpeg-param="-max_muxing_queue_size" --ffmpeg-param="1000" for ffmpeg [...] -max_muxing_queue_size 1000) (multiple values allowed)
-a, --silence-min-length[=SILENCE-MIN-LENGTH] silence minimum length in milliseconds [default: 1750]
-b, --silence-max-length[=SILENCE-MAX-LENGTH] silence maximum length in milliseconds [default: 0]
--max-chapter-length[=MAX-CHAPTER-LENGTH] maximum chapter length in seconds - its also possible to provide a desired chapter length in form of 300,900 where 300 is desired and 900 is max - if the max chapter length is exceeded, the chapter is placed on the first silence between desired and max chapter length [default: "0"]
--audio-format[=AUDIO-FORMAT] output format, that ffmpeg will use to create files [default: "m4b"]
--audio-channels[=AUDIO-CHANNELS] audio channels, e.g. 1, 2 [default: ""]
--audio-bitrate[=AUDIO-BITRATE] audio bitrate, e.g. 64k, 128k, ... [default: ""]
--audio-samplerate[=AUDIO-SAMPLERATE] audio samplerate, e.g. 22050, 44100, ... [default: ""]
--audio-codec[=AUDIO-CODEC] audio codec, e.g. libmp3lame, aac, ... [default: ""]
--audio-profile[=AUDIO-PROFILE] audio profile, when using extra low bitrate - valid values (mono, stereo): aac_he, aac_he_v2 [default: ""]
--adjust-for-ipod auto adjust bitrate and sampling rate for ipod, if track is to long (may lead to poor quality)
--name[=NAME] provide a custom audiobook name, otherwise the existing metadata will be used [default: ""]
--sortname[=SORTNAME] provide a custom audiobook name, that is used only for sorting purposes [default: ""]
--album[=ALBUM] provide a custom audiobook album, otherwise the existing metadata for name will be used [default: ""]
--sortalbum[=SORTALBUM] provide a custom audiobook album, that is used only for sorting purposes [default: ""]
--artist[=ARTIST]