GithubHelp home page GithubHelp logo

jtagger's Introduction

JTagger

JTagger is a Java library for editing and parsing metadata in audio files. Supports M4A, FLAC, Ogg Vorbis, Ogg FLAC, Ogg Opus, MP3(ID3v1, ID3v1.1, ID3v2.3, ID3v2.4)

Basic example using generic MediaFile:

MediaFile<AbstractTag, StreamInfo> mediaFile = new MediaFile<>();
mediaFile.scan(new File(mediaPath), "rw");
AbstractTag tag = mediaFile.getTag();
StreamInfo info = mediaFile.getStreamInfo();

// print tag information
System.out.printf("%s=%s\n", AbstractTag.TITLE, tag.getStringField(AbstractTag.TITLE));
System.out.printf("%s=%s\n", AbstractTag.ARTIST, tag.getStringField(AbstractTag.ARTIST));
System.out.printf("%s=%s\n", AbstractTag.ALBUM, tag.getStringField(AbstractTag.ALBUM));

// print stream information
int duration = info.getDuration();
System.out.printf("Duration: %02d:%02d\n", duration / 60, duration % 60);
System.out.printf("Sampling rate: %d HZ\n", info.getSampleRate());
System.out.printf("Bitrate: %d kbps\n", info.getBitrate());
System.out.printf("Channels: %d\n", info.getChannelCount());

// set fields
tag.setStringField(AbstractTag.ARTIST, "Roxette");
tag.setStringField(AbstractTag.TITLE, "Neverending Love");
tag.setStringField(AbstractTag.ALBUM, "Pearls of Passion");

// set album cover
AttachedPicture picture = new AttachedPicture();
picture.setPictureData(new File(picturePath)); // accepts URL as well
tag.setPictureField(picture);

// save and close
mediaFile.setTag(tag);
mediaFile.save();
mediaFile.close();

jtagger's People

Contributors

rrtry avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.