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
參數,而第一個匹配將首先使用。因此,如果您按照上述方式創建了目錄結構,則最終命令將輸入output/Fantasy/Harry Potter/1 - Harry Potter and the Philosopher's Stone.m4b
input/Fantasy/Harry Potter/1 - Harry Potter and the Philosopher's Stone/
1 - Harry Potter and the Philosopher's 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]