how to extract video and audio meta data?

How can I extract meta data from various video file formats?

  • How can I extract meta data from various video file formats, especially the Resolution and the type of codec used. (But also all other stuff like author). I was not able to find a library for that.

  • Answer:

    I have found MediaInfo (http://mediainfo.sourceforge.net/) which supplies dozens of technical and tag information about a video or audio file. There is a JNI wrapper for MediaInfo in http://code.google.com/p/subs4me/ http://code.google.com/p/subs4me/source/browse/trunk/Subs4me/src/net/sourceforge/filebot/mediainfo/?r=93 that I find very useful. Here are some code snippets that show how to extract some information from a media file: String fileName = "path/to/my/file"; File file = new File(fileName); MediaInfo info = new MediaInfo(); info.open(file); String format = info.get(MediaInfo.StreamKind.Video, i, "Format", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); int bitRate = info.get(MediaInfo.StreamKind.Video, i, "BitRate", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); float frameRate = info.get(MediaInfo.StreamKind.Video, i, "FrameRate", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); short width = info.get(MediaInfo.StreamKind.Video, i, "Width", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); int audioBitrate = info.get(MediaInfo.StreamKind.Audio, i, "BitRate", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); int audioChannels = info.get(MediaInfo.StreamKind.Audio, i, "Channels", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name);

jens at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.