mp3tagiconv

目前 Linux 中的 mp3 标签处理工具虽能使 MP3 文件在 Linux 中被正确识别,但由于以 ID3v1 标签写入方式不对,致使其无法被 Windows 及 Windows Media Player 识别,导致在 Windows 资源管理器中无法正确显示 mp3 文件的中文标签。

惟一可能正确处理中文标签的 easytag,不能在多种文本编码中猜测,且不适于用写脚本进行大批量处理,而且要正确写入编码需要配置的,默认设置不行。感谢 Chen Xing 来稿

这个小工具,mp3tagiconv,可以方便地处理MP3文件的标签(主要面向中英文),使其在Linux和Windows的多数软件中都不会出现乱码。代码托管在 Google Code 上。

程序基于 mutagen 使用 python 语言写成,系统安装了 mutagen 后程序即可直接运行。使用方法简单,如:

mp3tagiconv 一个或多个MP3文件路径

程序不会影响编码已经完全正确的文件。

为了避免破坏文件,默认情况下在修改标签前会先把解码后的标签显示出来,待用户确定。

与 mid3iconv 的不同:

  1. 写 id3v1 时默认使用 gbk 而非 latin-1 编码,确保其可被 Windows Media Player 识别。
  2. 读标签时综合 ID3v1 和 ID3v2,避免丢失标签中的信息
  3. 处理标签时可猜测 mp3 文件现在使用的编码
  4. 默认不写文件,避免误操作

程序在我自己的很多MP3文件上正常,但没有做太大规模的测试,如果大家感兴趣,可以帮忙测试一下~

PS: MP3乱码问题的详细背景

以Wiki模式创建Linux中文文档,欢迎加入 Linux Wiki

Read More:

  • » No related posts

31 Comments

  1. 1 liang Commented @ 2010-08-04 6:43Reply to this comment

    网站有bug?我刚才reader点进来时mobile界面。(win7, firefox3.6)

  2. 2 chi Commented @ 2010-08-04 8:35Reply to this comment

    我偶尔也会进入mobile版,arch, chromium
    文章不错,只是几个li列表显示不对,还有”MP3乱码问题的详细背景“的地址直接横贯网页了。
    求修复。

  3. 3 Boild Commented @ 2010-08-04 8:53Reply to this comment

    你们不说我还没注意到,我就纳闷为什么有几次排版变简单了,像RSS列表……

  4. 4 walkerxk Commented @ 2010-08-04 9:08Reply to this comment

    debian+最新ff,MP3乱码问题的详细背景那个连接自动换行了,chromium问题?

  5. 5 walkerxk Commented @ 2010-08-04 9:09Reply to this comment

    果然,chrome也是没换行。

  6. 6 walkerxk Commented @ 2010-08-04 9:18Reply to this comment

    webkit问题?konqueror也没换行,opera也换行了,再装几个其他的浏览器试试。

  7. 7 eagle Commented @ 2010-08-04 9:19Reply to this comment

    如果是优先读取id3v1的,那不就乱码了?

  8. 8 chi Commented @ 2010-08-04 9:27Reply to this comment

    @walkerxk: 原来如此

  9. 9 Petty Commented @ 2010-08-04 9:41Reply to this comment

    能不能开放一个公共接口,现在一些例行升级之类的消息Toy不在,也没人发,2.6.35的内核和NV的新驱动……

  10. 10 Rothsdad Commented @ 2010-08-04 9:57Reply to this comment

    恩,支持一下Petty.

    我也很想为linuxtoy做一份贡献.

  11. 11 autoxbc Commented @ 2010-08-04 9:58Reply to this comment

    无论用什么工具,把原理弄清楚就简单多了,能够被多系统兼容的标签格式是 gbk 编码的 ID3v1 +UTF-8 编码的 ID3v2.4。

  12. 12 Petty Commented @ 2010-08-04 10:06Reply to this comment

    @autoxbc: ID3v2(UTF-16LE)<2.4&APEv2

  13. 13 walkerxk Commented @ 2010-08-04 10:15Reply to this comment

    其实自己用shell写个直接编辑mp3文件的也行,iconv+sed。

  14. 14 Hexchain Commented @ 2010-08-04 10:53Reply to this comment

    貌似 mid3iconv 有 --remove-v1 / --force-v1 选项吧……这个没有用?

  15. 15 stlxv Commented @ 2010-08-04 11:49Reply to this comment

  16. 读标签时综合 ID3v1 和 ID3v2,避免丢失标签中的信息
  17. 处理标签时可猜测 mp3 文件现在使用的编码
  18. 默认不写文件,避免误操作
  19. 这个,改改吧……

  20. 16 lululau Commented @ 2010-08-04 11:53Reply to this comment

    舍弃id3v1才是王道,我也写过一个id3 tag的编辑工具,就是安装麻烦了点

    http://liu-xiang.appspot.com/lulunochichadian/iTagEdit.html

  21. 17 kidfruit Commented @ 2010-08-04 13:10Reply to this comment

    个人认为最通用的编码方式是ID3v2.3UTF-16。这种方式基本上可以在所有系统各种播放器都能正确识别。

    ID3v1对中文支持差,v2.4有的播放器不支持,v2.3UTF-16既能支持各国文字又能保持兼容性。

  22. 18 Petty Commented @ 2010-08-04 13:29Reply to this comment

    @kidfruit: 不错,不过现在这个问题已经比较小了,常见的闭源的播放器如千千和FB2K都是APEv2+ID3v1写入。

  23. 19 fanhe Commented @ 2010-08-04 13:37Reply to this comment

    我是直接删掉id3v1的,然后之用utf-8的id3v2.最那啥的是,手机某个播放软件居然只认utf-16 ……

  24. 20 kidfruit Commented @ 2010-08-04 14:10Reply to this comment

    @Petty: 貌似foobar2000现在新版本默认改为了ID3v2.4UTF-8?

  25. 21 Gyteng Commented @ 2010-08-04 15:05Reply to this comment

    好东西,目前流行的linux下去除mp3乱码的方法会导致win下显示成??????

  26. 22 黑日白月 Commented @ 2010-08-04 18:21Reply to this comment

    不好意思,少敲了两个换行,结果版式乱了……

  27. 23 黑日白月 Commented @ 2010-08-04 18:25Reply to this comment

    @Rothsdad:

    如果有稿件的话可以发到我邮箱,谢谢:

    tommy.he AT linux.com

  28. 24 ihipop Commented @ 2010-08-04 18:44Reply to this comment

    话说我用amork2的标签自动探测后就没乱码过

  29. 25 billma Commented @ 2010-08-04 19:58Reply to this comment

    @ihipop: mp3的编码探测很纠结,一共这么点儿信息,基本上不能探测出什么东西了,只能是硬猜……

  30. 26 ee.zsy Commented @ 2010-08-04 22:37Reply to this comment

    有个叫 MusicDNS 的东西可以分析音乐自动补全tag

  31. 27 root9885 Commented @ 2010-08-04 22:56Reply to this comment

    听的尽是国外金属 没有乱码压力

  32. 28 muzuiget Commented @ 2010-08-05 10:04Reply to this comment

    我的解决方法是直接对播放器下手,免得转换。

  33. 29 billma Commented @ 2010-08-05 20:02Reply to this comment

    @muzuiget: 对那些python写的播放器改起来很简单,c写的就麻烦了

  34. 30 Chen Xing Commented @ 2010-08-11 15:27Reply to this comment

    @eagle: 优先读取ID3v1的软件一般都是老软件,会优先测试本地编码的。目前还没有发现优先读ID3v1并用unicode解码的播放软件。

  35. 31 pocoyo Commented @ 2010-08-14 2:40Reply to this comment

    不小心搞了下 全乱了。。。