Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-05

ID3v2 - Reading and writing MP3 metadata

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

luciano de souza

Hello listers,
I friend has sent me a component to read and write mp3 tags. In particular, I am interested in the ID3v2 pattern.
In theory, the attatched component could do what I want. I can't make sure, but I think it is not working very well.
When I use ID3v1 tags, title, artist, album, comment, track, genre, the sucess is total. However, when I use ID3v2 tags like "composer", the tag is not created or updated. The executable is generated without erros, it runs without erros, but does not fills up the "composer" tag.
So I ask you: do you knows how to write "composer" tag in a mp3 file? The solution can be with this or another component. Actually, if this component is bugged, it's really sad. It's so simple to use... let's show:

program id3;
{$mode objfpc}{$H+}
uses
sysutils, id3v2;
var
tagger: TID3v2;
BEGIN
tagger := TID3v2.create;
try
with tagger do
begin
track := StrToInt64Def('12', 0);
title := 'O meu título';
artist := 'O meu artista';
album := 'O meu álbum';
year := '2013';
comment := 'O meu comentário';
genre := 'clássico';
composer := 'O meu compositor';
SavetoFile('01.mp3');
end;
finallyt
tagger.free;
end;
END.
Luciano de Souza

Reply by email

leledumbo
to luciano de souza

As wikipedia explains, ID3v1 and ID3v2 are completely unrelated and have different structure. Without seeing what your friend unit contains, it's hard to tell whether he implements both versions correctly or not. But since you said the version 1 works, and I don't see anything discriminating the two version in your sample code (again, this can't be concluded without seeing the actual unit code), I guess he only implements version 1.

Apparently, Cactus Jukebox supports ID3, both version 1 and 2. The related unit is here:
https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/cactusjukebox/source/tagreader/mp3file.pas You can see how it's used here:
https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/cactusjukebox/source/mediacol.pas

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/ID3v2-Reading-and-writing-MP3-metadata-tp5714707p5714708.html Sent from the Free Pascal - General mailing list .

Reply by email

luciano de souza
to leledumbo

Well, the unit you present me seems to only support ID3v1. I said: "It works only under the ID3v1 pattern!" No. Its not correct. What I want to say is that only the same tags filled under the ID3v1 pattern is filled when I use the TID3v2 class. So the attached unit and the mentioned example behaves as the ID3v1 was the active supported pattern.
In my example, "composer" is the single tag present in v2, not present in v1. Attached is the unit sent to me.
ID3v1 is a very simple pattern. It's enough to read the last 128 byte of the mp3 file, assigning it to a record. So with simple blockreads and blockwrites, the work is done without difficulties. ID3v2 is much more complex.
After visiting http://www.id3.org, I got some information for developers. Hum.. The ID3v2 is so complex that I think I was not able to implement it if it is already available.

2013/5/9, leledumbo :

Show quoted text 25 lines
As wikipedia explains, ID3v1 and ID3v2 are completely unrelated and have different structure. Without seeing what your friend unit contains, it's hard to tell whether he implements both versions correctly or not. But since you said the version 1 works, and I don't see anything discriminating the two version in your sample code (again, this can't be concluded without seeing the actual unit code), I guess he only implements version 1. Apparently, Cactus Jukebox supports ID3, both version 1 and 2. The related unit is here: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/cactusjukebox/source/tagreader/mp3file.pas You can see how it's used here: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/cactusjukebox/source/mediacol.pas -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/ID3v2-Reading-and-writing-MP3-metadata-tp5714707p5714708.html Sent from the Free Pascal - General mailing list . _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Luciano de Souza

Reply by email

Fred van Stappen
to luciano de souza

Well, the unit you present me seems to only support ID3v1. I said: "It works only under the ID3v1 pattern!" No. Its not correct. What I want to say is that only the same tags filled under the ID3v1 pattern is filled when I use the TID3v2 class. So the attached unit and the mentioned example behaves as the ID3v1 was the active supported pattern.
In my example, "composer" is the single tag present in v2, not present in v1. Attached is the unit sent to me.
ID3v1 is a very simple pattern. It's enough to read the last 128 byte of the mp3 file, assigning it to a record. So with simple blockreads and blockwrites, the work is done without difficulties. ID3v2 is much more complex.
After visiting http://www.id3.org, I got some information for developers. Hum.. The ID3v2 is so complex that I think I was not able to implement it if it is already available.
e Free Pascal - General mailing list

Hello.
Im busy to implement ID3v2 tag in uos.
Im nearly ready...
https://github.com/fredvs/uos

Reply by email

luciano de souza
to Fred van Stappen: Well, the unit you present me seems to only support ID3v1. I said: "It works only under…

I didn't test it becose I didn't find the "composer" tag in the source code. Without the "composer" tag, I can conclude it does not support ID3V2.
I observed also that "genre" is an integer. At ID3v2, "genre" became a string.

2013/5/9, Fred van Stappen :

Show quoted text 25 lines
Well, the unit you present me seems to only support ID3v1. I said: "It works only under the ID3v1 pattern!" No. Its not correct. What I want to say is that only the same tags filled under the ID3v1 pattern is filled when I use the TID3v2 class. So the attached unit and the mentioned example behaves as the ID3v1 was the active supported pattern. In my example, "composer" is the single tag present in v2, not present in v1. Attached is the unit sent to me. ID3v1 is a very simple pattern. It's enough to read the last 128 byte of the mp3 file, assigning it to a record. So with simple blockreads and blockwrites, the work is done without difficulties. ID3v2 is much more complex. After visiting http://www.id3.org, I got some information for developers. Hum.. The ID3v2 is so complex that I think I was not able to implement it if it is already available. e Free Pascal - General mailing list . ______________________________________________ Hello. Im busy to implement ID3v2 tag in uos. Im nearly ready... https://github.com/fredvs/uos
Luciano de Souza

Reply by email