0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Shift_JISで保存されているmp3タグをUTF-8へ直す

Posted at

概要

mp3音楽ファイルを整理していると、曲名やアーティスト名が文字化けしているファイルがあることに気づきました。どうもShift_JISでmp3タグが保存されていることが原因のようでした。複数のmp3ファイルが文字化けしているため、一気に文字コード変換をかけたいです。今回は音楽ファイルを保存しているのがUbuntuサーバ上だったこともあり、「easy tag」を使用して複数の音楽ファイルの文字コードを変換しました。mp3タグの文字コード変換に関する情報があまりなく、ここに個人的な手順をまとめておきます。

easy tagをインストール

sudo apt -y install easytag
easytag --version
# easytag 2.4.3
# Website: https://wiki.gnome.org/Apps/EasyTAG

「easy tag」にて編集

現状、複数のフォルダに複数のmp3ファイルがあり、mp3タグがShift_JISのものとUTF-8のものが混在しています。
そのため、easy tagの設定を、文字コード変換作業がしやすいような設定に変更します。

  • Interface
    • 「Display changed files in list using:」を「赤色」の方が見やすそう
  • Files
    • 「Preserve modification time when writing files」をオフ
    • 「Update parent directory modification time when writing files」をオフ
  • ID3 Tags
    • 「Non-standard encoding for reading ID3 tags:」を「日本語(Shift-JIS)」へ
    • ID3v2でタグを書き込む:バージョンを「ID3v2.4」へ
    • 「古いバージョンID3v2タグを自動的に変換する」をオフ(本当にオフにしたほうが良いかは未確認)

修正のコツを示します。

  • 設定ウィンドウ(メニューバー > Edit > Preference)の「ID3 Tags」を表示しっぱなしにする
  • 必要に応じて「Non-standard encoding for reading ID3 tags:」のチェックボックスオン・オフを切り替え「日本語(Shift-JIS)」とUTF-8を切り替え、対象のファイルを探す
    • 切り替え後は「リストの更新」を行うこと(メニューバー > View > フォルダの再読み込み(Ctrl + R))
  • 「日本語(Shift-JIS)」の状態(文字化けせずに表示されている状態)の時に、Force Save Files(Ctrl + Shift + S)で保存する

修正したファイルについて

easy tagにてファイルを編集した後、どのファイルを編集したのか分からなくなる時があります。通常の場合、ファイルの更新日時が変更されているので、以下のようなコマンドで一覧できます。
例えば、2025年2月23日に修正したファイルを出力するコマンドです。

cd /path/to/music_dir
find . -type f -newermt "2025-02-01"

mpvで音楽ファイルを確認する手順

Rhythmboxをインストールできなかったので、あきらめて代わりにmpvというツールを使います。

sudo apt -y install mpv

# pseudo-gui を指定することで、必ずGUIが表示されるようになる
mpv --player-operation-mode=pseudo-gui "/path/to/music/test.mp3"

# 画面表示させずに起動してしまい、終了したいとき
kill $(ps aux | grep mpv | awk '{print $2}' | head -n 1)

参考情報です。

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?