Jan 4, 2009

HOWTO: compiling mediainfo (CLI & GUI) on Ubuntu

Today, I will cover a must-have tool for anyone who likes to play with audio / video transcoding : mediainfo.

Indeed, mediainfo will tell you everything you need to know about the format and properties of basically any type of picture, audio or video file.

For instance:
ubuntu% mediainfo video.mpg 
General
Complete name : video.mpg
Format : MPEG-PS
File size : 41.8 MiB
Duration : 2mn 59s
Overall bit rate : 1 954 Kbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 1
Format settings, Matrix : Default
Duration : 2mn 59s
Bit rate mode : Constant
Bit rate : 1 594 Kbps
Nominal bit rate : 1 700 Kbps
Width : 352 pixels
Height : 288 pixels
Display aspect ratio : 4/3
Frame rate : 25.000 fps
Scan type : Progressive
Bits/(Pixel*Frame) : 0.629

Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 2mn 59s
Bit rate mode : Constant
Bit rate : 224 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Resolution : 16 bits
Video delay : 280ms
And the '-f' flag (for full) will tell you even more! Now you that you're convinced, let's install it :) mediainfo is available both as a command-line tool and as a graphical tool, so I'll show you both installations on Ubuntu 8.04.

1) Installing the command-line version

This is very straightforward:

ubuntu% wget http://ovh.dl.sourceforge.net/sourceforge/mediainfo/MediaInfo_CLI_0.7.8_GNU_FromSource.tar.bz2
ubuntu% bzip2 -d MediaInfo_CLI_0.7.8.tar.bz2
ubuntu% tar xvf MediaInfo_CLI_0.7.8_GNU_FromSource.tar

ubuntu% cd MediaInfo_CLI_0.7.8_GNU_FromSource
ubuntu% sh CLI_Compile.sh
ubuntu% cd MediaInfo/Project/GNU/CLI
ubuntu% sudo make install

Done :) You can now invoke the 'mediainfo' command.

2) Installing the graphical version

The GUI of mediainfo is based on wxWindows, a cross-platform toolkit for GTK (the X Window toolkit), Windows and MacOS.

In our case, we will use GTK, so let's start with the installation of the GTK development library:

ubuntu% sudo apt-get install libgtk2.0-dev

Then, let's install the wxWidgets library, used by the mediainfo GUI. First, we need to update the list of APT repositories by adding the following line to /etc/apt/sources.list:
deb http://apt.wxwidgets.org/ hardy-wx main
Now, let's update the package list and fetch the wxWidgets package:

ubuntu% sudo apt-get update
ubuntu% sudo apt-get install libwxgtk2.8-0


Now we're ready to build the GUI version of mediainfo:

ubuntu% wget http://ovh.dl.sourceforge.net/sourceforge/mediainfo/MediaInfo_GUI_0.7.8_GNU_FromSource.tar.bz2
ubuntu% bzip2 -d MediaInfo_GUI_0.7.8.tar.bz2
ubuntu% tar xvf MediaInfo_GUI_0.7.8_GNU_FromSource.tar

ubuntu% cd MediaInfo_GUI_0.7.8_GNU_FromSource
ubuntu% sh GUI_Compile.sh
ubuntu% cd MediaInfo/Project/GNU/GUI
ubuntu% sudo make install

The GUI version of mediainfo is now available using the 'mediainfo-gui' command.

That's it for the installation of mediainfo. I'm sure you'll find this tool extremely useful and I'll definitely use it in future posts to illustrate audio & video formats.

3 comments:

  1. thanks Julien, this made my day... (spent days to get this running with the .deb files... but my YAMJ just didn't wanted to extract the movie-data). cheers, J.

    ReplyDelete
  2. You're welcome. Glad I could help :)

    ReplyDelete