Last updated on June 17, 2020 by Dan Nanni
If your music player does not display some MP3 tracks correctly (e.g., with garbled symbols), it is most likely that the character encoding of ID3 tags is not supported on your Linux system. You can often encounter this problem when song titles or artist names are written in Cyrillic, Greek, Chinese, Japanese or Korean characters.
To solve this problem, you need to convert character encoding of ID3 tags to UTF-8/Unicode. The very tool that can do such conversion is
mid3iconv command-line tool. Using
mid3iconv, you can convert ID3 tags from any arbitrary character encoding to Unicode.
mid3iconv tool is part of
python-mutagen package, which is universally available on major Linux platforms.
$ sudo apt-get install python-mutagen
$ sudo yum install python-mutagen
The typical command-line usage of
mid3iconv is as follows.
$ mid3iconv -e <source-encoding> -d input.mp3
The above command converts the character encoding of input MP3 file's ID3 tag from
Unicode. If you want to "dry-run" the conversion without actually modifying a MP3 file, you can add
For example, to convert ID3's character encoding from
$ mid3iconv -e CP1251 -d input.mp3
-p option, the converted ID3 tag will be overwritten to an input MP3 file.
Now let's try to fix broken characters in MP3 ID3 tags with
The first thing you need to do is to identify the character encoding used by your MP3 files. You may be able to guess their character encoding if you know where they are from. For example, if MP3 files are Japanese songs, the encoding may be
EUC-JP, while Chinese songs may be encoded with
GB 2312 or
GBK, etc. If you are not sure, you can use
mid3iconv's "dry-run" option to find it out.
That is, choose any encoding from:
$ iconv --list
and apply conversion (with "dry-run" option):
$ mid3iconv -p -d e <source-encoding> input.mp3
If the output is readable, that means you guessed a source encoding correctly.
Once you know what ID3 encoding your MP3 files are using, use the following command to batch-convert ID3 character encoding for all your MP3 files.
$ find . -name "*mp3" -print0 | xargs -0 mid3iconv -e <source-encoding> -d
For example, if ID tags of your MP3 songs are encoded with
EUC-KR (Korean characters), use the below command to fix broken characters.
$ find . -name "*mp3" -print0 | xargs -0 mid3iconv -e EUR-KR -d
Verify that MP3 files are displayed correctly.
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.