AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

mp3 duration

Ein Thema von DmVinny · begonnen am 3. Apr 2009 · letzter Beitrag vom 4. Apr 2009
 
Benutzerbild von Gausi
Gausi

Registriert seit: 17. Jul 2005
907 Beiträge
 
Delphi 12 Athens
 
#3

Re: mp3 duration

  Alt 3. Apr 2009, 18:59
Hi again.

You can use Mp3FileUtils for this also.
Delphi-Quellcode:
var Id3v1Tag: TId3v1Tag;
  Id3v2Tag: TId3v2Tag;
  mpegInfo: TMpegInfo;
  stream: TFileStream;
begin
  stream := TFileStream.Create(aFileName, fmOpenRead or fmShareDenyWrite);
  Id3v2Tag.ReadFromStream(stream); // Read the id3v2Tag first (recommended, reading MPEG-Info will be much slower otherwise)

  // Seek to the end of the ID3Tag, if exists
  if Not Id3v2Tag.exists then
    stream.Seek(0, sobeginning)
  else
    stream.Seek(Id3v2Tag.size, soFromBeginning);

  // read MPEG-Information (like duration, bitrate, and so on)
  MpegInfo.LoadFromStream(Stream);

  // optionally: read the old id3v1-Tag
  Id3v1Tag.ReadFromStream(stream);
  stream.free;
end;
The duration (in seconds) is then stored in mpegInfo.Dauer ("Dauer" is german for "duration" - maybe I should change this. )
Being smart will count for nothing if you don't make the world better. You have to use your smarts to count for something, to serve life, not death.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:29 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz