What should you do when you want to introduce your favorite songs, the ones you always listen to, on a blog or something? If it's just the song names, you might be able to select all the folders and copy them.
But what if you also want to write the artist names?
At this point, it becomes programming, but what if you want to get only the titles of a specific artist in a folder?
That's when ffmpeg's "ffprobe" comes in handy.
Want to Know the Types of Metadata
If you want to know the types of metadata in the first place, use the ffprobe command.
For cases like wondering how BPM is written...
ffprobe "0002 - Broken 8cmix.mp3"
Metadata:
encoder : LAME 32bits version 3.99.5 (http://lame.sf.net)
title : Broken 8cmix
artist : iroha(sasaki)
album : Sound Voltex Soundtrack
track : 2
album_artist : Various Artists
disc : 1/3
TBPM : 150
TLEN : 107205
Output MP3 Metadata as CSV
By replacing the format_tags= option with any metadata, you can change the output.
for f in *; do
echo "\
$(ffprobe -loglevel error -show_entries format_tags=track -of default=noprint_wrappers=1:nokey=1 "$f"),\
$(ffprobe -loglevel error -show_entries format_tags=title -of default=noprint_wrappers=1:nokey=1 "$f"),\
$(ffprobe -loglevel error -show_entries format_tags=artist -of default=noprint_wrappers=1:nokey=1 "$f")\
"
done
Output MP3 Metadata as CSV (with Double Quotes)
for f in *; do
echo "\
\"$(ffprobe -loglevel error -show_entries format_tags=track -of default=noprint_wrappers=1:nokey=1 "$f")\",\
\"$(ffprobe -loglevel error -show_entries format_tags=title -of default=noprint_wrappers=1:nokey=1 "$f")\",\
\"$(ffprobe -loglevel error -show_entries format_tags=artist -of default=noprint_wrappers=1:nokey=1 "$f")\"\
"
done
Other Features
- Want to know the number of songs
You can count the number of songs by counting the number of output lines with | wc -l.
- mp3info
By the way, there's also an option called mp3info,
but mp3info is not recommended because it has many bugs.
$ mp3info -p %t "0002 - Broken 8cmix.mp3"
%a
$ mp3info -p %t "0008 - smoooochã»âã» KN mix.mp3"
smooooch??? KN mix
It has garbled characters or some kind of strange conversion. Not good.