The Codec 'Problem'

April 30, 2013

By far the most common issue faced by developers of applications that use DirectShow is receiving complaints about certain file formats not being supported. Unbeknown to them is that the developers of such applications should not necessarily be the subject of the user's ire. This is where it gets a little confusing for the poor average user who can't for the life of them fathom why a file should play perfectly well in one player but not in another - and it is not unreasonable for them, on that basis, to pronounce one player inferior to the other. So how does this come about and is it necessarily true?

Let's first attempt to answer the first part of my self-posed question.

Possible player bugs aside, the reason why a player can or cannot playback a file is due to the presence or absence of the required codecs. So what is a codec? In simple terms, a codec is a program of sorts that 'understands' how to decode the data in a video or  audio stream, both of which combine to show you those nice moving pictures you see on your screen and the accompanying sound  that is emitted from your speakers. If you can visualise a chain, where at one end you have a video file stored on your computer and at the other end your screen, then the codec is a link in that chain between the two. There are other links in that chain, too, but we'll ignore those for the purpose of this article. Suffice it to say that if a codec is installed on your system that can handle a particular video format, you should be good to go.

But wait!

Didn't we say at the outset that, some players can play a file whilst others cannot...on the same PC? Well, yes, we did and the reason for this is that there are two ways of developing a player:

1) Code it so that it uses the DirectShow architecture that is part of Windows.
In this case, the statement is true; if a codec is installed on the PC then any DirectShow-based player wil be able to play a file supported by that codec.

2) Write your own player AND your own codecs.
In this case, the statement is false; if the codecs are proprietary to the player (i.e. not exposed via DirectShow), then that player can play the file types for which it has written its own codecs but other players cannot use the codecs that belong to that player.

So, to summarise, if you have a file that is only playable by some of your media players, the chances are that those players are not using the DirectShow architecture.

Now that we know all that, we can start to examine the second part of the question: Are such players better? On the face of it, it does indeed seem reasonable to assert that a player that can play anything is better than one that cannot and even I find it difficult to  disagree with that. For a start, if all that the user has to do is install 'Player X', for example, in order to playback all types of videos and never have to worry about unsupported formats then that has to be a good thing, right?

But, then, one wonders; if the developers of said players were happy to write their own codecs why did they bother when there are equivalent DirectShow codecs? And if there weren't equivalent DirectShow codecs (rare), why not write new ones? And this is where it gets messy...

You see, in spite of the best intentions of the folks at Microsoft, their vision for a system-wide video platform, DirectShow, came to be abused because it had a terrible flaw; the Merit System. This system was intended to allow some codecs to be 'preferred' over others in cases where more than one codec was capable of doing a given task; the one with the highest 'merit' (a numerical value) got the  job! This is the area that came to be abused by developers; new codecs would be installed on a user's machine and, without consent, be given a high Merit in order to oust the codec that preceded it. Somebody elsewhere likened it to a 'nuclear arms race'. Against this background, then, it is no wonder that there are media players who have 'gone unilateral', since they can ring-fence themselves from this codec-hell and remain in control of what goes on in their own little worlds.

OK, then, more compelling reasons to say that 'proprietary' players are better but I cannot leave it there without making a few more observations and points.

Firstly, the DirectShow approach is logically better. Because its codecs are accessible system-wide, any program can use them and that is a good thing; many users do more than just watch videos and rely on an array of tools to work with their media. Besides, if the codec is a wheel, it really makes no sense for every program that needs one to re-invent it.

Secondly, the 'arms race' referred to above is not, to my knowledge, as big a problem as it once was. It seems that nowadays there are just a few main players in the Codec arena and all of them tend to offer 'packs' (collections of codecs) that mainly comprise the same components - usually including LAV Filters.

 

My advice is to avoid the codec packs unless you know what you are doing and just download LAV Filters.

Please reload

Featured Posts

Easy, Tree-sy

March 9, 2017

Wouldn't it be nice if you could navigate to an item (i.e. a tag) in the Library Tree without having to expand all of the 'branches' that contain it?

W...

1/2
Please reload

Recent Posts

April 4, 2017

March 9, 2017

February 24, 2017

April 30, 2013

Please reload

Search By Tags
Please reload

Blog

Thoughts, musings and handy Vee-Hive hints and tips...