Sign in Join

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

Mailing lists / fpc-pascal / 2003-12

id3 tagging in mp3 / vorbis

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

baron kractor

Wondering if anyone had done any work with manipulating id3 tag information contained in mp3 / vorbis files from within fpc and could point me to some documentation?

Reply by email

Unknown author
to baron kractor
baron kractor wrote
Wondering if anyone had done any work with manipulating id3 tag information contained in mp3 / vorbis files from within fpc and could point me to some documentation?

This code reads the tag from an mp3 file:

program showmp3;
{$mode objfpc}
{$h+}
Uses Classes;
Type
  TID3Tag = Packed Record
    TAG : Array[1..3] of char;
    Title : Array[1..30] of char;
    Artist : Array[1..30] of char;
    Album : Array[1..30] of char;
    Year : Array[1..4] of char;
    Comment : Array[1..30] of char;
    Genre : Byte;
  end;
Procedure ShowInfo(Fn : String);
Var
  Info : TID3Tag;
begin
  With TFileStream.Create(FN,fmOpenRead) do
    try
      Seek(-(SizeOf(Info)),soFromEnd);
      Read(Info,SizeOf(Info));
      With Info do
        begin
        Writeln('File : ',Fn);
        Writeln('Title : ',Title);
        Writeln('Artist : ',Artist);
        Writeln('Album : ',Album);
        Writeln('Year : ',Year);
        Writeln('Comment : ',Comment);
        Writeln('Genre : ',Genre);
        end;
    Finally
      Free;
    end;
end;
Var I : Integer;
begin
  For I:=1 to ParamCount do
    ShowInfo(Paramstr(i));
end.

Writing the tag can be done in the same manner.

Somewhere on internet (DSP/Torry's delphi pages) there is a 'mpgtools' unit which can be compiled with FPC, it can also be used. I used to have it in compiled form, but I can't find it, only the program which I used to test :
program showextmp3;

{$mode objfpc}
uses mpgtools,sysutils;
begin
  With TMPEGAudio.Create do
    try
      FileName:=Paramstr(1);
      Writeln('Author',Artist);
      Writeln('Duration ',FormatDateTime('hh:nn:ss',DurationTime));
    finally
      Free;
    end;
end.

This is all I can do, hopefully it is enough to get you started...

Michael.

Reply by email

Marco van de Voort
to Unknown author
Show quoted text 7 lines
On Sun, 28 Dec 2003, baron kractor wrote: > Wondering if anyone had done any work with manipulating id3 tag information > contained in mp3 / vorbis files from within fpc and could point me to some > documentation? This code reads the tag from an mp3 file:

I've some more routines that don't get upset from a ID3v2 tag.

See the contributed unit page, xtdfpc package.

Reply by email