Handling MPEG audio metadata

Reading MPEG audio metadata

MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio. Originally defined as the third audio format of the MPEG-1 standard, it was retained and further extended — defining additional bitrates and support for more audio channels — as the third audio format of the subsequent MPEG-2 standard. The GroupDocs.Metadata API allows reading some common MPEG audio properties from MP3 files.

The following steps demonstrate how to read MPEG audio metadata from an MP3 file.

  1. Load an MP3 file
  2. Get the root metadata package
  3. Use the MP3RootPackage.MpegAudioPackageproperty to read the metadata values

AdvancedUsage.ManagingMetadataForSpecificFormats.Audio.MP3.MP3ReadMpegAudioMetadata

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

	Console.WriteLine(root.MpegAudioPackage.Bitrate);
	Console.WriteLine(root.MpegAudioPackage.ChannelMode);
	Console.WriteLine(root.MpegAudioPackage.Emphasis);
	Console.WriteLine(root.MpegAudioPackage.Frequency);
	Console.WriteLine(root.MpegAudioPackage.HeaderPosition);
	Console.WriteLine(root.MpegAudioPackage.Layer);

	// ...

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

Along with full featured .NET library we provide simple, but powerful free Apps. You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.