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.

Note

For more information on the MP3 and MPEG standards please check the following articles:

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.getMpegAudioPackagemethod to read the metadata values

advanced_usage.managing_metadata_for_specific_formats.audio.mp3.MP3ReadMpegAudioMetadata

try (Metadata metadata = new Metadata(Constants.MP3WithID3V2)) {
	MP3RootPackage root = metadata.getRootPackageGeneric();

	System.out.println(root.getMpegAudioPackage().getBitrate());
	System.out.println(root.getMpegAudioPackage().getChannelMode());
	System.out.println(root.getMpegAudioPackage().getEmphasis());
	System.out.println(root.getMpegAudioPackage().getFrequency());
	System.out.println(root.getMpegAudioPackage().getHeaderPosition());
	System.out.println(root.getMpegAudioPackage().getLayer());

	// ...
}

More resources

GitHub examples

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

MP3 metadata management demo App

The MP3 Metadata Editing app is available to view and edit metadata of MP3 audio files, including title, artist, album, genre, and other ID3 tags.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.