如何从api 8获取mp3或mp4的元数据,但又不想使用ffmpegMediametadataretriever库,因为该库的大小为13 mb,这对我来说不是一个好解决方案!谁能帮我获取URL的id3tag吗?!我尝试了很多方法,例如id3tag的可用Java库,但我做不到。请帮助我。任何我喜欢的代码示例。
我使用的代码:

Mp3File mp3file = null;
            尝试{
                mp3file = new Mp3File(“ http://www.stephaniequinn.com/Music/Commercial%20DEMO%20-%2009.mp3”);
            } catch(IOException e){
                e.printStackTrace();
            } catch(UnsupportedTagException e){
                e.printStackTrace();
            } catch(InvalidDataException e){
                e.printStackTrace();
            }

        if (mp3file.hasId3v1Tag()) {
            ID3v1 id3v1Tag = mp3file.getId3v1Tag();
            System.out.println("Track: " + id3v1Tag.getTrack());
            System.out.println("Artist: " + id3v1Tag.getArtist());
            System.out.println("Title: " + id3v1Tag.getTitle());
            System.out.println("Album: " + id3v1Tag.getAlbum());
            System.out.println("Year: " + id3v1Tag.getYear());
            System.out.println("Genre: " + id3v1Tag.getGenre() + " (" + id3v1Tag.getGenreDescription() + ")");
            System.out.println("Comment: " + id3v1Tag.getComment());
        }

最佳答案

尝试FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource("some MP3 URL");
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM);
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
byte [] artwork = mmr.getEmbeddedPicture();

mmr.release();

09-12 13:07