Windows, Mac?This guide is for Linux. These methods can work can also work with WSL (Windows Subsystem for Linux), and some are crossplatform. Maybe can also work on Macs, I have not tried it.
File Chapter Ordering & Metadata [Linux]Use case:Happy leech new audiobook. Your audiobook player import files after, there is a mess! All files are "Chapter 1"? What is going on?? Clearly, the files are named 1,2,3...
Why does the audiobook player not know this? File metadata is set incorrectly.
Or other cases, incorrect audiobook title, audiobook artist is "Unknown", incorrect chapter title,... All these are due to wrong metadata. 5 min can fix.
#1 Kid3:https://kid3.kde.org/ Want GUI, no want black box? This is for you.
Why use it?
- Like GUI
- Modern graphics
- No need guide
Why not use it?
- Need kde
- Not like GUI
- Cannot automate
#2 How: eyeD3:Why use it?
- Ease of use
- Many files same time
- Instant
Why not use it?
First need install: python. Recommend use pipx.
https://github.com/nicfit/eyeD3Install after can check file info:
Here is example of bad metadata, track 5,
https://audiobookbay.lu/abss/then-road-less-traveled-and-beyond-m-scott-peck/ :
Time: 47:06 MPEG1, Layer III
[ ~95 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------
ID3 v2.3:
title: Track 1
artist:
album:
track: 1
Title expect "Track 5", get "Track 1". Track expect 5, get 1. This can confuse audiobook player. Want to correct? Easy!
eyeD3 track5.mp3 --title "Track 5" --track 5
Or short:
eyeD3 track5.mp3 -t "Track 5" -n 5
Fix!
Now, want to fix many file at once. First, view info all file in album.
This selects all mp3 file. * is wildcard, *.mp3 is all files with type mp3. Want to view info all file wav?
Example results:
...NF/The road less travelled and beyond/Track 1.mp3 [ 29.32 MB ]
---------------------------------------
Time: 46:44 MPEG1, Layer III
[ ~87 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 1
artist:
album:
track: 1
---------------------------------------
...NF/The road less travelled and beyond/Track 2.mp3 [ 30.21 MB ]
---------------------------------------
Time: 46:00 MPEG1, Layer III
[ ~91 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 2
artist:
album:
track: 1
---------------------------------------
...NF/The road less travelled and beyond/Track 3.mp3 [ 32.89 MB ]
---------------------------------------
Time: 48:19 MPEG1, Layer III
[ ~95 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 2
artist:
album:
track: 1
---------------------------------------
...NF/The road less travelled and beyond/Track 4.mp3 [ 32.41 MB ]
---------------------------------------
Time: 47:47 MPEG1, Layer III
[ ~94 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 2
artist:
album:
track: 1
---------------------------------------
...NF/The road less travelled and beyond/Track 5.mp3 [ 32.19 MB ]
---------------------------------------
Time: 47:06 MPEG1, Layer III
[ ~95 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 1
artist:
album:
track: 1
---------------------------------------
...NF/The road less travelled and beyond/Track 6.mp3 [ 4.45 MB ]
---------------------------------------
Time: 06:31 MPEG1, Layer III
[ ~95 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------
ID3 v2.3:
title: Track 2
artist:
album:
track: 2
Want all set album, artist?
eyeD3 *.mp3 --album "The road less travelled and beyond" --artist "M. Scott Peck"
This sets album and artist for all mp3 in current directory.
How: Advanced eyeD3:Not want manual set title, track? This is a little more work. Not intuitive.
#Bash. Create script file in audiobook directory:
#!/bin/bash
for x in *.mp3; do
fn="${x%.mp3}"
eyeD3 "$x" --title="$fn" --track "${fn//[^0-9]/}"
echo "$a"
done
This is for mp3. Wav? Change *.mp3 to *.wav. Make script file executable:
Important: this changes all mp3 in that directory. One directory only have one album. You are in correct directory? Then can execute:
Finish!
#3 How: id3v2: Same like eyeD3.
#4 How: ffprobe/ffmpeg Why use it?
- Already install, no need install new
- Many user
Why not use it?
- Slow, cannot overwrite
- Syntax difficult
Need install? No. Most machine already is install. Check
Your version older than 4.4.0? Upgrade.
Long guide (external):
Read and Write Tags of Music Files with FFmpegShort guide:First, examine metadata. Single file:
ffprobe -i "Track 4.mp3" -show_format -print_format json
All files in dir (mp3):
find . -name "*.mp3" -print -exec ffprobe -i "{}" -show_format -print_format json \;
For other format, replace "
.mp3" with ".YOURFORMAT". For wav, "*.wav".
Example output:
Metadata:
encoder : LAME3.99
"format": {
"filename": "./Track 4.mp3",
"nb_streams": 1,
"nb_programs": 0,
"format_name": "mp3",
"format_long_name": "MP2/3 (MPEG audio layer 2/3)",
"start_time": "0.025057",
"duration": "2866.703673",
"size": "33986519",
"bit_rate": "94844",
"probe_score": 51,
"tags": {
"title": "Track 2",
"track": "1"
}
}
See filename is not same as tags, title. And tags title is not same as tags, track. It is incorrect.
Want to change?
ffmpeg -i "Track 4.mp3" -metadata title="Track 4" "Track 4_2.mp3"
Why put "Track 4_2.mp3"? This is output file. FFmpeg cannot change/overwrite file. Only make copy with correct data. Very slow. But can use.
All metadata tags are listed here:
FFmpeg Metadata#5 Tone Want to edit many many, many files?
tone is very good.
Why use it?
- Bulk edit, very fast
- Linux, windows, mac, all can
- Support many formats (can m4b!)
- Beautiful CLI
Why not use it?
- Expert ware, recommend basic script experience
- Incomplete guide
- In development
Incomplete guide. WIP.
First need install:
Windows, mac, follow instructions on github.
Linux, find out your architecture, use uname command.
uname -m
Example:
This example show architecture linux-x64. If say arm, select file for arm.
After, select right file, follow github instructions.
Install after, want inspect file. First use mp3. Here is example of bad metadata, track 5,
https://audiobookbay.lu/abss/then-road-less-traveled-and-beyond-m-scott-peck/ :
Result:
properties
┌───────────────────┬───────────────────────────────────┐
│ format │ MPEG Audio (Layer III): audio/mp3 │
│ bitrate │ 95 │
│ sample-rate │ 44100 │
│ duration │ 00:06:31.262 │
│ vbr │ True │
│ channels │ 2 (Joint Stereo) │
│ 2 meta formats │ ID3v2.3 │
│ │ ID3v1.1 │
└───────────────────┴───────────────────────────────────┘
metadata
┌───────────────────┬─────────┐
│ title │ Track 2 │
│ track-number │ 2 │
└───────────────────┴─────────┘
Track title, track number wrong. No set artist album for file.
Fix:
tone tag "Track 6.mp3" --meta-title "Track 6" --meta-track-number 6
Result:
DIFF: ...tester/Track 6.mp3
┌───────────────────────────────────┬───────────────────────┬──────────────────────┐
│ property │ current │ new │
├───────────────────────────────────┼───────────────────────┼──────────────────────┤
│ Title │ Track 2 │ Track 6 │
│ TrackNumber │ 2 │ 6 │
└───────────────────────────────────┴───────────────────────┴──────────────────────┘
Update: ...tester/Track 6.mp3
The command is long. Want automate, change eyeD3 bash script.
#!/bin/bash
for x in *.mp3; do
fn="${x%.mp3}"
tone tag "$x" --meta-title="$fn" --meta-track-number "${fn//[^0-9]/}"
echo "$a"
done
Make executable:
chmod +x tone_script_file
Important: the script change all mp3 file in dir. Use in correct dir!
Execute:
Expert hint: Tone offer option, filename to tag via --path-pattern. If you know script, can optimize like that. Run many folder.
Questions? Ask!