Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android MediaMetadataRetriever returns null values from most keys

I want to get information out of my media files (mp3 mostly) and I get only null from those values I want. I have tried all keys for extractMetadata(key). Am I skipping/missing something?

Code basis:

MediaMetadataRetriever f = new MediaMetadataRetriever();
f.setDataSource(item.getFilePath());

String title = f.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);

I do get correct values with the duration key (MediaMetadataRetriever.METADATA_KEY_DURATION) and mimetype key (MediaMetadataRetriever.METADATA_KEY_MIMETYPE), which indicates that the datasource/filepath is working.

Poweramp (popular media player) is able to read metadata values, like title/author/composer etc. since it displays these extra values in the UI. Or perhaps Poweramp gets these values from some other source or method?

Any help is appreciated.

like image 784
gorn Avatar asked Sep 17 '12 19:09

gorn


1 Answers

This may sound silly but have you tried with many different mp3 files? Just with my experience if you get your mp3 files illegally the keys sometimes just aren't there.

like image 162
Jake B Avatar answered Nov 14 '22 20:11

Jake B