ID3V2Tag

ID3V2Tag class

Represents an ID3v2 tag. Please find more information at https://en.wikipedia.org/wiki/ID3#ID3v2.

public sealed class ID3V2Tag : ID3Tag

Constructors

Name Description
ID3V2Tag() Initializes a new instance of the ID3V2Tag class.

Properties

Name Description
Album { get; set; } Gets or sets the Album/Movie/Show title. This value is represented by the TALB frame.
Artist { get; set; } Gets or sets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group. This value is represented by the TPE1 frame.
AttachedPictures { get; set; } Gets or sets the attached pictures directly related to the audio file. This value is represented by the APIC frame.
Band { get; set; } Gets or sets the Band/Orchestra/Accompaniment. This value is represented by the TPE2 frame.
BitsPerMinute { get; set; } Gets or sets the number of beats per minute in the main part of the audio. This value is represented by the TBPM frame.
Comments { get; set; } Gets or sets the user comments. This value is represented by the COMM frame. The frame is intended for any kind of full text information that does not fit in any other frame.
Composers { get; set; } Gets or sets the composers. The names are separated with the “/” character. This value is represented by the TCOM frame.
ContentType { get; set; } Gets or sets the content type. This value is represented by the TCON frame.
Copyright { get; set; } Gets or sets the copyright message. This value is represented by the TCOP frame.
Count { get; } Gets the number of metadata properties.
Date { get; set; } Gets or sets a numeric string in the DDMM format containing the date for the recording. This field is always four characters long. This value is represented by the TDAT frame.
EncodedBy { get; set; } Gets or sets the name of the person or organization that encoded the audio file. This value is represented by the TENC frame.
Isrc { get; set; } Gets or sets the International Standard Recording Code (ISRC) (12 characters). This value is represented by the TSRC frame.
Item { get; } Gets the MetadataProperty with the specified name.
Keys { get; } Gets a collection of the metadata property names.
LengthInMilliseconds { get; set; } Gets or sets the length of the audio file in milliseconds, represented as a numeric string. This value is represented by the TLEN frame.
MetadataType { get; } Gets the metadata type.
MusicalKey { get; set; } Gets or sets the musical key in which the sound starts. This value is represented by the TKEY frame.
OriginalAlbum { get; set; } Gets or sets the original album/movie/show title. This value is represented by the TOAL frame.
PropertyDescriptors { get; } Gets a collection of descriptors that contain information about properties accessible through the GroupDocs.Metadata search engine.
Publisher { get; set; } Gets or sets the name of the label or publisher. This value is represented by the TPUB frame.
SizeInBytes { get; set; } Gets or sets the size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string. This value is represented by the TSIZ frame.
SoftwareHardware { get; set; } Gets or sets the used audio encoder and its settings when the file was encoded. This value is represented by the TSSE frame.
Subtitle { get; set; } Gets or sets the Subtitle/Description refinement. This value is represented by the TIT3 frame.
TagSize { get; } Gets the size of the tag.
Time { get; set; } Gets or sets a numeric string in the HHMM format containing the time for the recording. This field is always four characters long. This value is represented by the TIME frame.
Title { get; set; } Gets or sets the Title/Song name/Content description. This value is represented by the TIT2 frame.
TrackNumber { get; set; } Gets or sets a numeric string containing the order number of the audio-file on its original recording. This value is represented by the TRCK frame.
TrackPlayCounter { get; } Gets the number of times the file has been played. This value is represented by the PCNT frame.
override Version { get; } Gets the ID3 version.
Year { get; set; } Gets or sets a numeric string with a year of the recording. This frames is always four characters long (until the year 10000). This value is represented by the TYER frame.

Methods

Name Description
Add(ID3V2TagFrame) Adds a frame to the tag.
virtual AddProperties(Func<MetadataProperty, bool>, PropertyValue) Adds known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well.
Clear(string) Removes all frames with the specified id.
Contains(string) Determines whether the package contains a metadata property with the specified name.
virtual FindProperties(Func<MetadataProperty, bool>) Finds the metadata properties satisfying the specified predicate. The search is recursive so it affects all nested packages as well.
Get(string) Gets an array of frames with the specified id.
GetEnumerator() Returns an enumerator that iterates through the collection.
Remove(ID3V2TagFrame) Removes the specified frame from the tag.
RemoveAttachedPictures() Removes all attached pictures stored in APIC frames.
virtual RemoveProperties(Func<MetadataProperty, bool>) Removes metadata properties satisfying the specified predicate.
virtual Sanitize() Removes writable metadata properties from the package. The operation is recursive so it affects all nested packages as well.
Set(ID3V2TagFrame) Removes all frames having the same id as the specified one and adds the new frame to the tag.
virtual SetProperties(Func<MetadataProperty, bool>, PropertyValue) Sets known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well. This method is a combination of AddProperties and UpdateProperties. If an existing property satisfies the predicate its value is updated. If there is a known property missing in the package that satisfies the predicate it is added to the package.
ToList() Creates a list from the package.
virtual UpdateProperties(Func<MetadataProperty, bool>, PropertyValue) Updates known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well.

Remarks

Learn more

Examples

This example shows how to read the ID3v2 tag in an MP3 file.

using (Metadata metadata = new Metadata(Constants.MP3WithID3V2))
{
    var root = metadata.GetRootPackage<MP3RootPackage>();

    if (root.ID3V2 != null)
    {
        Console.WriteLine(root.ID3V2.Album);
        Console.WriteLine(root.ID3V2.Artist);
        Console.WriteLine(root.ID3V2.Band);
        Console.WriteLine(root.ID3V2.Title);
        Console.WriteLine(root.ID3V2.Composers);
        Console.WriteLine(root.ID3V2.Copyright);
        Console.WriteLine(root.ID3V2.Publisher);
        Console.WriteLine(root.ID3V2.OriginalAlbum);
        Console.WriteLine(root.ID3V2.MusicalKey);

        if (root.ID3V2.AttachedPictures != null)
        {
            foreach (var attachedPicture in root.ID3V2.AttachedPictures)
            {
                Console.WriteLine(attachedPicture.AttachedPictureType);
                Console.WriteLine(attachedPicture.MimeType);
                Console.WriteLine(attachedPicture.Description);

                // ...
            }
        }

        // ...
    }
}

See Also