I believe many of my friends may encounter garbled MP3 tags when playing MP3 in Linux, no matter which MP3 player is used. I usually use ex falso (an MP3 tag editor provided by quod libet) to edit tags when the MP3 tag is garbled, enable my player quod libet to recognize MP3 tags normally. When there were few conversion songs, there was no problem with doing so, but many of my friends who just switched from windows to LINUX started to grow, many MP3 labels that are normally displayed in windows are all messy in Linux.
Let's take a look at some of the MP3 tags and encoding concepts to solve this problem, and we will be clearer.
The tag types and encoding of MP3 mainly include id3v1, ID3v2 2.3, ID3v2 2.4, and apev2. They support encoding
Id3v1: Only ISO--8859-1 supported
ID3v2 2.3: ISO--8859-1, UTF-16
ID3v2 2.4: ISO--8859-1, UTF-16, UTF-8
Apev2: UTF-8
From the list above, we can see that the tag types and encoding of MP3 are diverse, and there are no rules at all. Id3v1 only supports ISO-8859-1 this encoding, it does not support Chinese, so generally only id3v1 tag MP3 in Linux are basically garbled, the formats supported by ID3v2 2.3 increase the UTF-16 until the ID3v2 2.4 version starts to support the UTF-8, but the two versions of ID3v2 standards do not have a uniform label content encoding. Here it is worth mentioning that apev2, which has the best scalability, It unified the encoding format for the UTF-8, in this way, as long as the player that supports apev2 reading plays MP3 files with the apev2 tag, there will be no garbled problem. Unfortunately, the MP3 files downloaded on Chinese websites basically do not have the apev2 tag, and few players in Linux support the read of the apev2 tag. (Currently, the rhythmbox in GNOME supports apev2 tag reading, including quod.
None of them are allowed .)
An mp3 tag can contain multiple types. When an MP3 file contains more than two types: id3v1, ID3v2 2.3, ID3v2 2.4, and apev2, the player generally reads MP3 tags from top to bottom. apev2 (provided that the player supports reading this encoding) --- ID3v2 --- id3v1. So sometimes the tag displayed in the same file rhythmbox is normal (read the apev2 tag), and other players are abnormal (read the ID3 tag ).
Next, let's talk about why all MP3 players have garbled characters in Linux, this is because these MP3 players rely on the libid3tag library in the system to completely read the TAG content according to the ID3 standard. No matter what standard tags MP3 adopts (id3v1, ID3v2, and apev2), as long as the content of MP3 tags is stored in Unicode encoding, so the display is certainly normal (id3v1 ISO-8859-1 strictly says it does not support Chinese, but does not mean it cannot store Chinese ). If it is to GBK, gb18030, big5 encoding of Chinese content, it will still take it as a ISO-8859-1 to read, garbled code has become inevitable.
Having said so much, the problem becomes simple now. It seems that we only need to change the Chinese content stored in the MP3 tags using GBK, gb18030, and big5 encoding to unicode encoding, basically, all Linux players can recognize MP3 tags normally.
For MP3 encoding conversion, here is a tool named mutagen. If you have installed quod libet, this package has been installed. If not, run the following command.
Sudo apt-Get install Python-mutagen
How to use the tool
Mid3iconv-e GBK *. MP3 # convert the MP3 file in the current directory
Find.-INAME "*. MP3"-execdir mid3iconv-e GBK {}\; # convert all MP3 files (including subdirectories) in the current directory)
Currently, most MP3 files downloaded from the internet use GBK/gb18030 encoding. The-e GBK parameter indicates converting the GBK encoding label to unicode encoding, if the MP3 tag is unicode encoded, It is not converted. If you want to convert other encoded files, you can modify the GBK parameter, for example, to gb18030 or big5. The converted MP3 tag type is ID3v2 2.4 and the encoding format is UTF-16.
After this step, it is estimated that there is no problem to use all players in Linux.
Next, let's look back at the root cause. Why are these MP3 files normally displayed with media player in windows? Is Linux not as good as windows? In fact, this principle is very simple. Firefox also cannot open many pages that can be easily opened by IE. Does it show that Firefox is not as good as Ie? People with knowledge can understand it at a glance. For its so-called compatibility, Windows completely ignores specifications and custom rules. It seems that its software compatibility is very good. In fact, in the end, it is still a waste of users, we can see from a large number of webpages that do not comply with W3C standards and the overwhelming MP3 tags are GBK/gb18030 encoded. (anyway, I have not seen a few MP3 files downloaded from the internet in Linux. normally displayed ).
We can tell you that, after using the above method to convert and encode, these MP3 files cannot display the tags normally in the file attribute menu and Media Player of windows, and will all be changed "? ". Because the mid3iconv command fills up d3v1, ID3v2, and apev2 tags with Unicode encoding by default during transcoding (the premise is that the file originally contains these types of tags ), however, id3v1 does not support Chinese unicode encoding. Media Player seems to only support id3v1 reading. Of course, you can use other software that supports ID3v2 and apev2 reading.
Here we recommend a Windows MP3 player, foobar2000. I used this player all the time in my previous windows career. foobar2000 supports reading a full range of tags, it is even more commendable that it uses ID3v2 2.4 by default to write the UTF-8 code, completely solving the encoding problem.
Provide the final solution provided by one person.
1. The system environment is completely linux.
Directly use the following command to convert all MP3 files, regardless of the Windows user experience.
Mid3iconv-e GBK *. MP3
Of course, if you want to prevent your MP3 files from being shared to users of windows or MP3, you will see "? ", You can add a -- remove-v1 parameter to directly Delete the id3v1 tag, avoiding file properties and Media Player appear "? ".
Mid3iconv-e GBK *. mp3 -- remove-v1
2. The system environment is Windows + LINUX dual-System
We recommend that you use the foobar2000 player to edit the MP3 tag of a file. You can select all MP3 files in foobar2000 to rewrite the file tag. foobar2000 will rewrite all tags, the label uses ID3v2 2.4 type UTF-8 encoding writing, completely solve the problem of MP3 file encoding in Windows and Linux. This is also a perfect solution.