greatseth / mediainfo

Ruby wrapper for the mediainfo CLI. http://mediainfo.sourceforge.net

This URL has Read+Write access

name age message
file .gitignore Fri Nov 20 14:31:04 -0800 2009 ignore project .irbrc [Seth Thomas Rasmussen]
file Changelog Wed Nov 25 12:56:19 -0800 2009 add xml configuration examples to rdoc [greatseth]
file LICENSE Tue May 05 18:47:06 -0700 2009 add license [greatseth]
file Manifest Wed Sep 16 12:33:56 -0700 2009 update local Echoe and fix a test from another ... [greatseth]
file README.markdown Wed Nov 25 12:49:20 -0800 2009 add xml parser configuration examples to readme [greatseth]
file Rakefile Wed Nov 25 12:56:19 -0800 2009 add xml configuration examples to rdoc [greatseth]
directory lib/ Wed Nov 25 12:56:19 -0800 2009 add xml configuration examples to rdoc [greatseth]
file mediainfo.gemspec Wed Nov 25 12:56:19 -0800 2009 add xml configuration examples to rdoc [greatseth]
directory test/ Mon Nov 23 20:02:33 -0800 2009 add error handling when attempting to use again... [Seth Thomas Rasmussen]
README.markdown

Mediainfo

Mediainfo is a class wrapping the mediainfo CLI.

Installation

$ gem install mediainfo -s http://gemcutter.org

Usage

info = Mediainfo.new "/path/to/file"

That will issue the system call to mediainfo and parse the output. You can specify an alternate path if necessary:

Mediainfo.path = "/opt/local/bin/mediainfo"

By default, REXML is used as the XML parser. If you'd like, you can configure Mediainfo to use Hpricot or Nokogiri instead using one of the following approaches:

  • define the MEDIAINFO_XML_PARSER environment variable to be the name of the parser as you'd pass to a :gem or :require call.

    e.g. export MEDIAINFO_XML_PARSER=nokogiri

  • assign to Mediainfo.xml_parser after you've loaded the gem, following the same naming conventions mentioned previously.

    e.g. Mediainfo.xml_parser = "hpricot"

Once you've got an instance setup, you can call numerous methods to get a variety of information about a file. Some attributes may be present for some files where others are not, but any supported attribute should at least return nil.

For a list of all possible attributes supported:

Mediainfo.supported_attributes

Requirements

This requires at least the following version of the Mediainfo CLI:

MediaInfo Command line,
MediaInfoLib - v0.7.25

Previous versions of this gem(<= 0.5.1) worked against v0.7.11, which did not generate XML output, and is no longer supported.

Contributors