How do you Edit Video ID3v2 Tags in Java

偶尔善良 提交于 2019-12-08 10:02:46

问题


I have been doing some research on ID3V2 tags and Video Formats such as MP4 and WMV. The two top libraries for editing ID3V2 tags seem to be:

Entagged and Jaudiotagger

Both of these support only audio formats. ( They support M4A and WMA but not MP4 and WMV ) I guess first off why is this? Then are they any alternatives.


回答1:


It appears JID3 will do the trick. It doesn't have any restrictions on extension.

http://jid3.blinkenlights.org/

Now hopefully someone finds this open-source project a designer!

Here is an example of using it with several different file formats:

public class JITExample {
  private static MediaFile audioFile;

  public static void main(String... megaThrustersAreGo) {

    //File file = new File("/home/rhigdon/Desktop/project-voltron/test-files/video.mp4");
    //File file = new File("/home/rhigdon/Desktop/project-voltron/test-files/movGetOutTheWay_iPhone_Cellular_1.3gp");
    File file = new File("/home/rhigdon/Desktop/project-voltron/test-files/movGetOutTheWay_HD_WMV_720p_1.wmv");
    //Entagged Soltuion

    audioFile = new MP3File(file);


    try {
      ID3V2_3_0Tag tag = new ID3V2_3_0Tag();
      tag.setArtist("Ryan Higdon");
      tag.setAlbum("Ryan's Funky Beats");
      audioFile.setID3Tag(tag);
      audioFile.sync();
      for (ID3Tag eachTag : audioFile.getTags()) {
        System.out.println(eachTag.toString());
      }

    } catch (ID3Exception e) {
      e.printStackTrace();
      System.out.println("something bad happened");
    }


  }
}



回答2:


According to the introduction page here http://www.id3.org/Introduction, ogg, wma and aac uses their own formats separated from ID3v2.
Another library for editing ID3v2 and playing mp3:s is JLayer. It doesn't need JMF and it is available for both J2SE and J2ME.



来源:https://stackoverflow.com/questions/1144864/how-do-you-edit-video-id3v2-tags-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!