DEV Community

uyriq
uyriq

Posted on

Powershell to fix incorrect encoding of MP3 ID3 tags

Powershell to fix incorrect encoding of MP3 ID3 tags (cyrrilic to UTF-8 encoding problem)

This PowerShell script corrects the encoding of ID3 tags in MP3 files. It is specifically designed for the problem where tags encoded in WINDOWS-1251 are incorrectly displayed as WINDOWS-1252, so going directly from 1251 to UTF-8. will not work.

Prerequisites

Before running this script, make sure you have the following:

  • PowerShell 5.1 or higher.
  • TagLibSharp.dll: This is required to work with MP3 tags. You can obtain `TagLibSharp.dll by either:
    • By downloading it from NuGet.
    • Or by compiling the source code available on GitHub.

How to use

  1. Get TagLibSharp.dll: To download or compile TagLibSharp.dll, see above.
  2. Locate TagLibSharp.dll in the same directory as the script: The script expects TagLibSharp.dll to be in the same directory from which the script is run.
  3. Prepare MP3 files: Make sure that all MP3 files you want to fix are placed in the same directory. The script will process all .mp3 files in the directory from which it is run.
  4. Run the script:.
    • Open PowerShell and navigate to the directory containing the script and TagLibSharp.dll.
    • Run the script by typing .\convertIDv3tags.ps1 and pressing Enter. The script will process each MP3 file in the catalog, correcting the ID3 tag encoding as described.

Notes

  • Backup your files:Before running the script, it is recommended that you back up your MP3 files to prevent unintentional data loss.
  • Script Restrictions: The script is specifically restricted to working with MP3 files. Changing the -Filter *.mp3 parameter to work with other file formats may not produce the desired results, although in general TagLibSharp.dll supports even video.

**NotaBene: if u wish experiment more with TagLibSharp dive in with

Top comments (0)