ID3 - a mp3 ID3v1/v2 tag reader/writer for Elixir

ID3 tags are a mess :frowning_face:

ID3v1 tags and ID3v2 tags aren’t compatible with each other. ID3v2.1 and ID3v2.4 uses different data structures.

There are a way to read/write ID3v1 tags in pure Elixir/Erlang. You just read the header of the file, using Bitstring. But things were not easy for ID3v2 tags.
Previous projects exists like ID3v2, but it is still just for reading.
I needed a library to write tags, so I can batch download mp3 files using Flow and HTTPoison, and edit metadata.

I tried by forking the library above, but it seemed a lot of work. So instead, I used a Rust library which is named rust-id3.
Thank you Rustler!

Currently this library supports only the major ID3 frames, like titles, artists, and years. Frames which could contain multiple data such as comments or images are yet to be done. (I am learning Rust as I implement…)

Usage are simple; Reading ID3 tag will be like this.

iex> {:ok, tag} = ID3.get_tag("audio.mp3")
iex> tag
  album_artist: "Queen",
  artist: "Queen",
  date_recorded: ~N[1977-10-07 00:00:00],
  date_released: ~N[1981-11-02 00:00:00],
  disc: 1,
  duration: nil,
  genre: "Rock",
  title: "We Will Rock You",
  total_discs: 1,
  total_tracks: 17,
  track: 16,
  year: 1981

You can edit the Tag struct, and write it back via ID3.write_tag("audio.mp3", new_tag).

This is my first Elixir library (if this is :slight_smile:). Please feel free to tell me what should be done to be better!
I should be able to continue on this project after a month or so. Thanks!


Hey thanks for the library, I just tried it but its not working.

I get this error during compilation.

thread 'main' panicked at 'Erlang version 2.16 not handled, please file a a bug report.',