Find Codec of Media File Programatically

Recently while working in some Media related project i had a task of finding which media i’m working on. I mean to find out if my player supports running that media. For that i need to work on a solution which can find a media type by reading file headers etc…

I have been shuffling between GSpot Codec Library / VLC / Mediainfo but i found out that Mediainfo is more Developer Friendly and can be easily Integrated into the application

Here is sample code which read details about media

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using MediaInfoLib;

 * Ashwin Kumar
 * 4/12/2011
 * Sample Command Line program to read and display Media type
 * Usage MediaInfoRead 
 * */
namespace MediaInfoRead
    class MediaInfoRead
        public static void Main(string[] args)
            String ToDisplay = "";
            MediaInfo MI = new MediaInfo();
            //An example of how to use the library
            ToDisplay += "\r\n\r\nOpen\r\n";

            ToDisplay += "\r\n\r\nInform with Complete=false\r\n";
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nInform with Complete=true\r\n";
            MI.Option("Complete", "1");
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nCustom Inform\r\n";
            MI.Option("Inform", "General;File size is %FileSize% bytes");
            ToDisplay += MI.Inform();

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n";
            ToDisplay += MI.Get(0, 0, "FileSize");

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n";
            ToDisplay += MI.Get(0, 0, 46);

            ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n";
            ToDisplay += MI.Count_Get(StreamKind.Audio);

            ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n";
            ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount");

            ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n";
            ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount");

            ToDisplay += "\r\n\r\nClose\r\n";


You Can checkout Sample C# project from following SVN location

Build Flowplayer From Source

There is no direct Link which gives proper instructions on how to build flowplayer. Here is my effort to build one

First goto flowplayer website and download source .Below is instruction

Once downloaded extract it to a folder

Rather than from website you can also get flowplayer-core source from

Now in folder above checkout following code base

Flowplayer build is dependent on the above plugins you download

now goto to flowplayer you downloaded from website and open

Make sure you update you flex installation Directory

# you need to adjust following to point to your Flex SDK


# change following to point to .exe files when running on Windows

mxmlc_bin= ${flex3bindir}/mxmlc.exe

compc_bin= ${flex3bindir}/compc.exe

asdoc_bin= ${flex3bindir}/asdoc.exe

Now Make sure you update the path for all plugins

plugin.buildfiles=bwcheck/build.xml,controls/build.xml,controls/build-air.xml,controls/build-tube.xml,controls/build-skinless.xml, \

for plugins that can be built inside the player

plugin-classes=${plugins.dir}controls/trunk/src/actionscript ${plugins.dir}content/trunk/src/actionscript  \
  ${plugins.dir}akamai/trunk/src/actionscript ${plugins.dir}rtmp/trunk/src/actionscript ${plugins.dir}pseudostreaming/trunk/src/actionscript \
  ${plugins.dir}audio/trunk/src/actionscript ${plugins.dir}bwcheck/trunk/src/actionscript ${plugins.dir}cluster/trunk/src/actionscript \
  ${plugins.dir}captions/trunk/src/actionscript ${plugins.dir}securestreaming/trunk/src/actionscript ${plugins.dir}smil/trunk/src/actionscript \

plugin-swc=${plugins.dir}controls/trunk/src/flash ${plugins.dir}content/trunk/src/flash ${plugins.dir}/viralvideos/trunk/src/flash ${plugins.dir}/pseudostreaming/trunk/libcontrols-dir=${plugins.dir}controls/trunk

Once configuration is updated you just goto to the directory where you unzipped downloaded flowplayer and then type “ant”

It Will automatically build all stuff for you

Make sure you have following in your machine before you build


Flex SDK:

Next tutorial is on adding our custom component to flowplayer……………………..